fixed a bug and added test files

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@337 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2024-02-16 01:06:48 +00:00
parent 5b3557841e
commit 5e365a8723
11 changed files with 52 additions and 26 deletions

View File

@ -143,6 +143,7 @@
"!le32" pseudo "!le32" pseudo
"!be32" pseudo "!be32" pseudo
"!tx" pseudo "!tx" pseudo
"!txt" pseudo
"!text" pseudo "!text" pseudo
"!raw" pseudo "!raw" pseudo
"!pet" pseudo "!pet" pseudo
@ -185,6 +186,8 @@
"!rl" pseudo "!rl" pseudo
"!rs" pseudo "!rs" pseudo
"!initmem" pseudo "!initmem" pseudo
"!debug" pseudo
"!info" pseudo
"!warn" pseudo "!warn" pseudo
"!error" pseudo "!error" pseudo
"!serious" pseudo "!serious" pseudo

View File

@ -341,12 +341,8 @@ static char GetQuotedByte(void)
// Skip remainder of statement, for example on error // Skip remainder of statement, for example on error
void input_skip_remainder(void) void input_skip_remainder(void)
{ {
while (GotByte) { // read characters until end-of-statement, but check for quotes,
GetByte(); // Read characters until end-of-statement // otherwise this might treat a quoted colon like EOS!
}
/* FIXME - check for quotes, otherwise this might treat a quoted colon like EOS!
this has already been a bug with "!to" and "!sl" where a workaround was implemented.
fix it here, once and for all, maybe like this:
dynabuf_clear(GlobalDynaBuf); dynabuf_clear(GlobalDynaBuf);
while (GotByte != CHAR_EOS) { while (GotByte != CHAR_EOS) {
// check for quotes // check for quotes
@ -357,7 +353,6 @@ fix it here, once and for all, maybe like this:
GetByte(); GetByte();
} }
dynabuf_clear(GlobalDynaBuf); dynabuf_clear(GlobalDynaBuf);
*/
} }
// Ensure that the remainder of the current statement is empty, for example // Ensure that the remainder of the current statement is empty, for example

View File

@ -68,6 +68,8 @@ void notreallypo_setpc(void) // GotByte is '*'
mutually exclusive with all other arguments! mutually exclusive with all other arguments!
this would mean to keep all previous segment data, this would mean to keep all previous segment data,
so it could be used with "*=*-5" or "*=*+3" so it could be used with "*=*-5" or "*=*+3"
} else if (strcmp(GlobalDynaBuf->buffer, "outfilestart") == 0) {
FIXME set flag to automatically do "!outfilestart" afterward.
} else if (strcmp(GlobalDynaBuf->buffer, "name") == 0) { } else if (strcmp(GlobalDynaBuf->buffer, "name") == 0) {
skip '=' skip '='
read segment name (quoted string!) */ read segment name (quoted string!) */
@ -129,20 +131,15 @@ static enum eos po_xor(void)
// select output file and format ("!to" pseudo opcode) // select output file and format ("!to" pseudo opcode)
static enum eos po_to(void) static enum eos po_to(void)
{ {
// bugfix: first read filename, *then* check for first pass. // only act upon this pseudo opcode in first pass
// if skipping right away, quoted colons might be misinterpreted as EOS if (!FIRST_PASS)
// FIXME - fix the skipping code to handle quotes! :) return SKIP_REMAINDER;
// "!sl" has been fixed as well
// read filename to global dynamic buffer // read filename to global dynamic buffer
// if no file name given, exit (complaining will have been done) // if no file name given, exit (complaining will have been done)
if (input_read_output_filename()) if (input_read_output_filename())
return SKIP_REMAINDER; return SKIP_REMAINDER;
// only act upon this pseudo opcode in first pass
if (!FIRST_PASS)
return SKIP_REMAINDER;
if (outputfile_set_filename()) if (outputfile_set_filename())
return SKIP_REMAINDER; return SKIP_REMAINDER;
@ -771,20 +768,15 @@ static enum eos po_set(void) // now GotByte = illegal char
// set file name for symbol list // set file name for symbol list
static enum eos po_symbollist(void) static enum eos po_symbollist(void)
{ {
// bugfix: first read filename, *then* check for first pass. // only process this pseudo opcode in first pass
// if skipping right away, quoted colons might be misinterpreted as EOS if (!FIRST_PASS)
// FIXME - why not just fix the skipping code to handle quotes? :) return SKIP_REMAINDER;
// "!to" has been fixed as well
// read filename to global dynamic buffer // read filename to global dynamic buffer
// if no file name given, exit (complaining will have been done) // if no file name given, exit (complaining will have been done)
if (input_read_output_filename()) if (input_read_output_filename())
return SKIP_REMAINDER; return SKIP_REMAINDER;
// only process this pseudo opcode in first pass
if (!FIRST_PASS)
return SKIP_REMAINDER;
// if symbol list file name already set, complain and exit // if symbol list file name already set, complain and exit
if (symbollist_filename) { if (symbollist_filename) {
Throw_warning("Symbol list file name already chosen."); Throw_warning("Symbol list file name already chosen.");

View 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 "12 Feb" // update before release FIXME #define CHANGE_DATE "13 Feb" // 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

View File

@ -1,13 +1,26 @@
.SILENT: .SILENT:
all: .PHONY: cpus errors warnings
all: bugfixes cpus errors warnings
bugfixes:
echo "Testing bugfixes..."
echo
make -C bugfixes
cpus:
echo "Testing CPUs..." echo "Testing CPUs..."
echo echo
make -C cpus make -C cpus
errors:
echo "Testing errors..." echo "Testing errors..."
echo echo
make -C errors make -C errors
warnings:
echo "Testing warnings..." echo "Testing warnings..."
echo echo
make -C warnings make -C warnings

15
testing/bugfixes/Makefile Normal file
View File

@ -0,0 +1,15 @@
ACMEFLAGS = -v0
FILES := $(wildcard *.a)
TESTS = $(subst .a,.test,$(FILES))
.SILENT:
%.test: %.a
echo "Testing bugfix:" $<
acme $(ACMEFLAGS) $<
echo "Ok."
all: $(TESTS)
echo
echo "Testing bugfixes: PASSED"
echo

View File

@ -0,0 +1,5 @@
*=$1000
; the "skip code" function did not honor quotes, so stuff after ':' was
; executed.
!ifdef UNDEFINED !tx " dummy : older versions tried to parse this!"
; fixing this supersedes two older fixes for "!to" and "!sl".

View File

@ -8,7 +8,7 @@ FILES = $(foreach N,$(CPUS),$(N).o)
echo "Testing CPU:" $(subst .o,,$@) echo "Testing CPU:" $(subst .o,,$@)
acme $(ACMEFLAGS) -o test.o $< acme $(ACMEFLAGS) -o test.o $<
cmp test.o expected-$@ cmp test.o expected-$@
rm test.o $(RM) test.o
echo "Ok." echo "Ok."
all: $(FILES) all: $(FILES)

View File

@ -0,0 +1 @@
!error "they'd all made a big mistake in coming down from the trees in the first place."

View File

@ -0,0 +1 @@
!serious "even the trees had been a bad move, no one should ever have left the oceans."

View File

@ -0,0 +1 @@
!warn "the trees had been a bad move, no one should ever have left the oceans."