From 0bea0d2254cde100663a266eeac214ecba63a6f4 Mon Sep 17 00:00:00 2001 From: marketideas Date: Sun, 17 Nov 2019 14:15:45 -0800 Subject: [PATCH] working on testdata tests --- asm.cpp | 23 ++++++++++++----------- opcodes.cpp | 2 +- qasm.cpp | 2 ++ runtests.sh | 5 ++++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/asm.cpp b/asm.cpp index 078ec69..f6a3307 100644 --- a/asm.cpp +++ b/asm.cpp @@ -56,7 +56,7 @@ void CLASS::print(uint32_t lineno) printf("\n%s in line: %d", errStrings[errorcode].c_str(), lineno + 1); if (errorText != "") { - printf("%s", errorText.c_str()); + printf(" (%s)", errorText.c_str()); } printf("\n"); } @@ -213,7 +213,11 @@ void CLASS::print(uint32_t lineno) { pcol += printf(" "); } - pcol += printf(":[Error] %s %s", errStrings[errorcode].c_str(), errorText.c_str()); + pcol += printf(":[Error] %s", errStrings[errorcode].c_str()); + if (errorText.length() > 0) + { + pcol += printf(" (%s)",errorText.c_str()); + } } else if (!commentprinted) { @@ -1376,13 +1380,15 @@ void CLASS::initpass(void) else { printf("Unknown CPU type in .ini\n"); - mx=0x00; + mx = 0x00; } - mx = getInt("asm.startmx",mx);; + mx = getInt("asm.startmx", mx);; + + savepath = getConfig("option.objfile", ""); relocatable = false; currentsym = NULL; - currentsymstr=""; + currentsymstr = ""; lineno = 0; errorct = 0; passcomplete = false; @@ -1409,7 +1415,6 @@ void CLASS::initpass(void) } curLUP.clear(); curDO.clear(); - savepath = ""; } void CLASS::complete(void) @@ -1421,10 +1426,6 @@ void CLASS::complete(void) std::string currentdir = Poco::Path::current(); savepath = processFilename(savepath, currentdir, 0); - if (isDebug() >= 1) - { - savepath += "1"; // append this to the end to help with testing against other assemblers - } printf("saving to file: %s\n", savepath.c_str()); std::ofstream f(savepath); @@ -1765,7 +1766,7 @@ void CLASS::process(void) if (c != ':') { currentsym = findSymbol(line.lable); - currentsymstr=line.lable; + currentsymstr = line.lable; } break; } diff --git a/opcodes.cpp b/opcodes.cpp index eae7528..bf5824c 100644 --- a/opcodes.cpp +++ b/opcodes.cpp @@ -182,7 +182,7 @@ int CLASS::doMVN(MerlinLine &line, TSymbol &sym) { value = 0xFFFFFFFF; line.setError(errBadOperand); - line.errorText = line.operand_expr2; + //line.errorText = line.operand_expr2; } setOpcode(line, op); diff --git a/qasm.cpp b/qasm.cpp index 958c157..8c06b3f 100644 --- a/qasm.cpp +++ b/qasm.cpp @@ -20,6 +20,8 @@ programOption PAL::appOptions[] = #endif //{ "config", "f", "load configuration data from a ", " ", false, false}, { "exec", "x", "execute a command [asm, link, reformat] default=asm", " ", false, false}, + { "objfile", "o", "write output to file", " ", false, false}, + { "", "", "", "", false, false} }; diff --git a/runtests.sh b/runtests.sh index 72c890b..a616547 100755 --- a/runtests.sh +++ b/runtests.sh @@ -13,11 +13,14 @@ SRC=`ls ./testdata` for S in $SRC ; do rm -f $TMPFILE - ./qasm ./testdata/$S >> $TMPFILE + ./qasm -o 0/$OUTDIR/$S ./testdata/$S >> $TMPFILE + R=?$ echo $S cat $TMPFILE | grep "End qASM assembly" done +ls -l $OUTDIR +