mirror of
https://github.com/uffejakobsen/acme.git
synced 2024-11-25 07:31:52 +00:00
rearranged struct, no change in functionality
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@399 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
fc296d6abd
commit
0af42c7a8a
28
src/acme.c
28
src/acme.c
@ -343,12 +343,12 @@ static void perform_pass(void)
|
|||||||
encoding_passinit(); // set default encoding
|
encoding_passinit(); // set default encoding
|
||||||
section_passinit(); // set initial zone (untitled)
|
section_passinit(); // set initial zone (untitled)
|
||||||
// init variables
|
// init variables
|
||||||
pass.undefined_count = 0;
|
pass.counters.undefineds = 0;
|
||||||
//pass.needvalue_count = 0; FIXME - use
|
//pass.counters.needvalue = 0; FIXME - use
|
||||||
pass.changed_count = 0;
|
pass.counters.symbolchanges = 0;
|
||||||
pass.error_count = 0;
|
pass.counters.errors = 0;
|
||||||
pass.warning_count = 0;
|
pass.counters.warnings = 0;
|
||||||
// Process toplevel files
|
// process toplevel files
|
||||||
for (ii = 0; ii < toplevel_src_count; ++ii) {
|
for (ii = 0; ii < toplevel_src_count; ++ii) {
|
||||||
fd = fopen(toplevel_sources_plat[ii], FILE_READBINARY);
|
fd = fopen(toplevel_sources_plat[ii], FILE_READBINARY);
|
||||||
if (fd) {
|
if (fd) {
|
||||||
@ -358,7 +358,7 @@ static void perform_pass(void)
|
|||||||
fprintf(stderr, "Error: Cannot open toplevel file \"%s\".\n", toplevel_sources_plat[ii]);
|
fprintf(stderr, "Error: Cannot open toplevel file \"%s\".\n", toplevel_sources_plat[ii]);
|
||||||
if (toplevel_sources_plat[ii][0] == '-')
|
if (toplevel_sources_plat[ii][0] == '-')
|
||||||
fprintf(stderr, "Options (starting with '-') must be given _before_ source files!\n");
|
fprintf(stderr, "Options (starting with '-') must be given _before_ source files!\n");
|
||||||
++pass.error_count;
|
++pass.counters.errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output_endofpass(); // make sure last code segment is closed
|
output_endofpass(); // make sure last code segment is closed
|
||||||
@ -366,8 +366,8 @@ static void perform_pass(void)
|
|||||||
// in the future to two general expressions, this is the point where
|
// in the future to two general expressions, this is the point where
|
||||||
// they would need to be evaluated.
|
// they would need to be evaluated.
|
||||||
if (config.process_verbosity >= 8)
|
if (config.process_verbosity >= 8)
|
||||||
printf("Undefined expressions: %d. Symbol updates: %d.\n", pass.undefined_count, pass.changed_count);
|
printf("Undefined expressions: %d. Symbol updates: %d.\n", pass.counters.undefineds, pass.counters.symbolchanges);
|
||||||
if (pass.error_count)
|
if (pass.counters.errors)
|
||||||
exit(ACME_finalize(EXIT_FAILURE));
|
exit(ACME_finalize(EXIT_FAILURE));
|
||||||
// now increment pass number
|
// now increment pass number
|
||||||
// this must be done _after_ the pass because assignments done via
|
// this must be done _after_ the pass because assignments done via
|
||||||
@ -396,11 +396,11 @@ static void do_actual_work(void)
|
|||||||
perform_pass(); // first pass
|
perform_pass(); // first pass
|
||||||
pass.flags.do_segment_checks = FALSE; // FIXME - do in _last_ pass instead!
|
pass.flags.do_segment_checks = FALSE; // FIXME - do in _last_ pass instead!
|
||||||
// pretend there has been a previous pass, with one more undefined result
|
// pretend there has been a previous pass, with one more undefined result
|
||||||
undefs_before = pass.undefined_count + 1;
|
undefs_before = pass.counters.undefineds + 1;
|
||||||
// keep doing passes as long as the number of undefined results keeps decreasing.
|
// keep doing passes as long as the number of undefined results keeps decreasing.
|
||||||
// stop on zero (FIXME - zero-check pass.needvalue_count instead!)
|
// stop on zero (FIXME - zero-check pass.counters.needvalue instead!)
|
||||||
while ((pass.undefined_count && (pass.undefined_count < undefs_before)) || pass.changed_count) {
|
while ((pass.counters.undefineds && (pass.counters.undefineds < undefs_before)) || pass.counters.symbolchanges) {
|
||||||
undefs_before = pass.undefined_count;
|
undefs_before = pass.counters.undefineds;
|
||||||
perform_pass();
|
perform_pass();
|
||||||
if (--sanity.passes_left < 0) {
|
if (--sanity.passes_left < 0) {
|
||||||
// FIXME - exit with error
|
// FIXME - exit with error
|
||||||
@ -410,7 +410,7 @@ static void do_actual_work(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// any errors left?
|
// any errors left?
|
||||||
if (pass.undefined_count == 0) { // FIXME - use pass.needvalue_count instead!
|
if (pass.counters.undefineds == 0) { // FIXME - use pass.counters.needvalue instead!
|
||||||
// if listing report is wanted and there were no errors,
|
// if listing report is wanted and there were no errors,
|
||||||
// do another pass to generate listing report
|
// do another pass to generate listing report
|
||||||
if (config.report_filename) {
|
if (config.report_filename) {
|
||||||
|
@ -2513,7 +2513,7 @@ static int parse_expression(struct expression *expression)
|
|||||||
// not empty. undefined?
|
// not empty. undefined?
|
||||||
if (!(result->type->is_defined(result))) {
|
if (!(result->type->is_defined(result))) {
|
||||||
// then count (in all passes)
|
// then count (in all passes)
|
||||||
++pass.undefined_count;
|
++pass.counters.undefineds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// do some checks depending on int/float
|
// do some checks depending on int/float
|
||||||
|
12
src/global.c
12
src/global.c
@ -533,15 +533,15 @@ void throw_message(enum debuglevel level, const char msg[], struct location *opt
|
|||||||
// (assembly stops, for example if outbuffer overruns).
|
// (assembly stops, for example if outbuffer overruns).
|
||||||
PLATFORM_SERIOUS(msg);
|
PLATFORM_SERIOUS(msg);
|
||||||
throw_msg(msg, "\033[1m\033[31m", "Serious error", opt_alt_loc); // bold + red
|
throw_msg(msg, "\033[1m\033[31m", "Serious error", opt_alt_loc); // bold + red
|
||||||
//++pass.error_count; // FIXME - needed when problem below is solved
|
//++pass.counters.errors; // FIXME - needed when problem below is solved
|
||||||
exit(ACME_finalize(EXIT_FAILURE)); // FIXME - this inhibits output of macro call stack
|
exit(ACME_finalize(EXIT_FAILURE)); // FIXME - this inhibits output of macro call stack
|
||||||
case DEBUGLEVEL_ERROR:
|
case DEBUGLEVEL_ERROR:
|
||||||
// output an error
|
// output an error
|
||||||
// (something is wrong, no output file will be generated).
|
// (something is wrong, no output file will be generated).
|
||||||
PLATFORM_ERROR(msg);
|
PLATFORM_ERROR(msg);
|
||||||
throw_msg(msg, "\033[31m", "Error", opt_alt_loc); // red
|
throw_msg(msg, "\033[31m", "Error", opt_alt_loc); // red
|
||||||
++pass.error_count;
|
++pass.counters.errors;
|
||||||
if (pass.error_count >= config.max_errors)
|
if (pass.counters.errors >= config.max_errors)
|
||||||
exit(ACME_finalize(EXIT_FAILURE));
|
exit(ACME_finalize(EXIT_FAILURE));
|
||||||
break;
|
break;
|
||||||
case DEBUGLEVEL_WARNING:
|
case DEBUGLEVEL_WARNING:
|
||||||
@ -552,11 +552,11 @@ void throw_message(enum debuglevel level, const char msg[], struct location *opt
|
|||||||
break;
|
break;
|
||||||
PLATFORM_WARNING(msg);
|
PLATFORM_WARNING(msg);
|
||||||
throw_msg(msg, "\033[33m", "Warning", opt_alt_loc); // yellow
|
throw_msg(msg, "\033[33m", "Warning", opt_alt_loc); // yellow
|
||||||
++pass.warning_count;
|
++pass.counters.warnings;
|
||||||
// then check if warnings should be handled like errors:
|
// then check if warnings should be handled like errors:
|
||||||
if (config.all_warnings_are_errors) {
|
if (config.all_warnings_are_errors) {
|
||||||
++pass.error_count;
|
++pass.counters.errors;
|
||||||
if (pass.error_count >= config.max_errors)
|
if (pass.counters.errors >= config.max_errors)
|
||||||
exit(ACME_finalize(EXIT_FAILURE));
|
exit(ACME_finalize(EXIT_FAILURE));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
16
src/global.h
16
src/global.h
@ -106,11 +106,17 @@ extern struct config config;
|
|||||||
|
|
||||||
struct pass {
|
struct pass {
|
||||||
int number; // counts up from one
|
int number; // counts up from one
|
||||||
int undefined_count; // counts undefined expression results (if this stops decreasing, next pass must list them as errors)
|
struct {
|
||||||
//int needvalue_count; // counts undefined expression results actually needed for output (when this hits zero, we're done) FIXME - use
|
int undefineds; // counts undefined expression results (if this stops decreasing, next pass must list them as errors)
|
||||||
int changed_count; // count symbol changes (if nonzero, another pass is needed)
|
//int needvalue; // counts undefined expression results actually needed for output (when this hits zero, we're done) FIXME - use
|
||||||
int error_count;
|
int symbolchanges; // count symbol changes (if nonzero, another pass is needed)
|
||||||
int warning_count;
|
int errors;
|
||||||
|
int warnings;
|
||||||
|
// FIXME - add a counter for "errors not reported because pass flags
|
||||||
|
// said so", because then we can read the value after all symbol changes
|
||||||
|
// have finally settled and know if the next pass is a victory lap or an
|
||||||
|
// error output pass.
|
||||||
|
} counters;
|
||||||
struct {
|
struct {
|
||||||
char complain_about_undefined; // will be FALSE until error pass is needed
|
char complain_about_undefined; // will be FALSE until error pass is needed
|
||||||
char do_segment_checks; // atm only used in pass 1, should be used in _last_ pass!
|
char do_segment_checks; // atm only used in pass 1, should be used in _last_ pass!
|
||||||
|
@ -244,7 +244,7 @@ void macro_parse_call(void) // Now GotByte = first char of macro name
|
|||||||
inputchange_new_ram(&icb);
|
inputchange_new_ram(&icb);
|
||||||
inputchange_macro1_params(&actual_macro->definition, actual_macro->parameter_list);
|
inputchange_macro1_params(&actual_macro->definition, actual_macro->parameter_list);
|
||||||
|
|
||||||
outer_msg_sum = pass.warning_count + pass.error_count; // remember for call stack decision
|
outer_msg_sum = pass.counters.warnings + pass.counters.errors; // remember for call stack decision
|
||||||
|
|
||||||
// remember old section
|
// remember old section
|
||||||
outer_section = section_now;
|
outer_section = section_now;
|
||||||
@ -300,7 +300,7 @@ void macro_parse_call(void) // Now GotByte = first char of macro name
|
|||||||
inputchange_back(&icb);
|
inputchange_back(&icb);
|
||||||
|
|
||||||
// if needed, dump call stack
|
// if needed, dump call stack
|
||||||
if (outer_msg_sum != pass.warning_count + pass.error_count)
|
if (outer_msg_sum != pass.counters.warnings + pass.counters.errors)
|
||||||
Throw_warning("...called from here.");
|
Throw_warning("...called from here.");
|
||||||
|
|
||||||
parser_ensure_EOS();
|
parser_ensure_EOS();
|
||||||
|
10
src/output.c
10
src/output.c
@ -189,11 +189,11 @@ void output_newdefault(void)
|
|||||||
{
|
{
|
||||||
// init memory
|
// init memory
|
||||||
fill_completely(config.mem_init_value);
|
fill_completely(config.mem_init_value);
|
||||||
// enforce another pass
|
// enforce another pass (FIXME - no, just do a separate output pass anyway!)
|
||||||
if (pass.undefined_count == 0)
|
if (pass.counters.undefineds == 0)
|
||||||
pass.undefined_count = 1;
|
pass.counters.undefineds = 1;
|
||||||
//if (pass.needvalue_count == 0) FIXME - use? instead or additionally?
|
//if (pass.counters.needvalue == 0) FIXME - use? instead or additionally?
|
||||||
// pass.needvalue_count = 1;
|
// pass.counters.needvalue = 1;
|
||||||
// enforcing another pass is not needed if there hasn't been any
|
// enforcing another pass is not needed if there hasn't been any
|
||||||
// output yet. But that's tricky to detect without too much overhead.
|
// output yet. But that's tricky to detect without too much overhead.
|
||||||
// The old solution was to add &&(out->lowest_written < out->highest_written+1) to "if" above
|
// The old solution was to add &&(out->lowest_written < out->highest_written+1) to "if" above
|
||||||
|
@ -571,8 +571,8 @@ static enum eos po_binary(void)
|
|||||||
// check whether including is a waste of time
|
// check whether including is a waste of time
|
||||||
// FIXME - future changes ("several-projects-at-once")
|
// FIXME - future changes ("several-projects-at-once")
|
||||||
// may be incompatible with this!
|
// may be incompatible with this!
|
||||||
if ((size.val.intval >= 0) && (pass.undefined_count || pass.error_count)) {
|
if ((size.val.intval >= 0) && (pass.counters.undefineds || pass.counters.errors)) {
|
||||||
//if ((size.val.intval >= 0) && (pass.needvalue_count || pass.error_count)) { FIXME - use!
|
//if ((size.val.intval >= 0) && (pass.counters.needvalue || pass.counters.errors)) { FIXME - use!
|
||||||
output_skip(size.val.intval); // really including is useless anyway
|
output_skip(size.val.intval); // really including is useless anyway
|
||||||
} else {
|
} else {
|
||||||
// really insert file
|
// really insert file
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#define RELEASE "0.97" // update before release FIXME
|
#define RELEASE "0.97" // update before release FIXME
|
||||||
#define CODENAME "Zem" // update before release
|
#define CODENAME "Zem" // update before release
|
||||||
#define CHANGE_DATE "1 Aug" // update before release FIXME
|
#define CHANGE_DATE "2 Aug" // update before release FIXME
|
||||||
#define CHANGE_YEAR "2024" // update before release
|
#define CHANGE_YEAR "2024" // update before release
|
||||||
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
|
||||||
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME
|
||||||
|
Loading…
Reference in New Issue
Block a user