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
"!be32" pseudo
"!tx" pseudo
"!txt" pseudo
"!text" pseudo
"!raw" pseudo
"!pet" pseudo
@ -185,6 +186,8 @@
"!rl" pseudo
"!rs" pseudo
"!initmem" pseudo
"!debug" pseudo
"!info" pseudo
"!warn" pseudo
"!error" pseudo
"!serious" pseudo

View File

@ -341,12 +341,8 @@ static char GetQuotedByte(void)
// Skip remainder of statement, for example on error
void input_skip_remainder(void)
{
while (GotByte) {
GetByte(); // Read characters until end-of-statement
}
/* 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:
// read characters until end-of-statement, but check for quotes,
// otherwise this might treat a quoted colon like EOS!
dynabuf_clear(GlobalDynaBuf);
while (GotByte != CHAR_EOS) {
// check for quotes
@ -357,7 +353,6 @@ fix it here, once and for all, maybe like this:
GetByte();
}
dynabuf_clear(GlobalDynaBuf);
*/
}
// 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!
this would mean to keep all previous segment data,
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) {
skip '='
read segment name (quoted string!) */
@ -129,20 +131,15 @@ static enum eos po_xor(void)
// select output file and format ("!to" pseudo opcode)
static enum eos po_to(void)
{
// bugfix: first read filename, *then* check for first pass.
// if skipping right away, quoted colons might be misinterpreted as EOS
// FIXME - fix the skipping code to handle quotes! :)
// "!sl" has been fixed as well
// only act upon this pseudo opcode in first pass
if (!FIRST_PASS)
return SKIP_REMAINDER;
// read filename to global dynamic buffer
// if no file name given, exit (complaining will have been done)
if (input_read_output_filename())
return SKIP_REMAINDER;
// only act upon this pseudo opcode in first pass
if (!FIRST_PASS)
return SKIP_REMAINDER;
if (outputfile_set_filename())
return SKIP_REMAINDER;
@ -771,20 +768,15 @@ static enum eos po_set(void) // now GotByte = illegal char
// set file name for symbol list
static enum eos po_symbollist(void)
{
// bugfix: first read filename, *then* check for first pass.
// if skipping right away, quoted colons might be misinterpreted as EOS
// FIXME - why not just fix the skipping code to handle quotes? :)
// "!to" has been fixed as well
// only process this pseudo opcode in first pass
if (!FIRST_PASS)
return SKIP_REMAINDER;
// read filename to global dynamic buffer
// if no file name given, exit (complaining will have been done)
if (input_read_output_filename())
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 (symbollist_filename) {
Throw_warning("Symbol list file name already chosen.");

View File

@ -9,7 +9,7 @@
#define RELEASE "0.97" // update before release FIXME
#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 HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME

View File

@ -1,13 +1,26 @@
.SILENT:
all:
.PHONY: cpus errors warnings
all: bugfixes cpus errors warnings
bugfixes:
echo "Testing bugfixes..."
echo
make -C bugfixes
cpus:
echo "Testing CPUs..."
echo
make -C cpus
errors:
echo "Testing errors..."
echo
make -C errors
warnings:
echo "Testing warnings..."
echo
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,,$@)
acme $(ACMEFLAGS) -o test.o $<
cmp test.o expected-$@
rm test.o
$(RM) test.o
echo "Ok."
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."