From: j8takagi Date: Thu, 28 Jan 2010 16:04:37 +0000 (+0900) Subject: ハッシュ関数を共用体版にし、ラベルの範囲をプログラム内だけで有効に X-Git-Tag: v0.1~74^2~13 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fda1563ea37180835e0b9c6e7a9c7ae607895446;p=YACASL2.git ハッシュ関数を共用体版にし、ラベルの範囲をプログラム内だけで有効に hash関数とlabelhash関数のテストが未成功 CASL2のOUTA関数など、グローバル変数を使用したコードが使えない --- diff --git a/include/assemble.h b/include/assemble.h index 139cea7..6372e19 100644 --- a/include/assemble.h +++ b/include/assemble.h @@ -50,7 +50,10 @@ typedef enum { SECOND = 1, } PASS; -/* ラベル表からアドレスを検索する */ +/* プログラム名とラベルに対応するハッシュ値を返す */ +unsigned labelhash(const char *prog, const char *label); + +/* プログラム名とラベルに対応するアドレスをラベル表から検索する */ WORD getlabel(const char *prog, const char *label); /* ラベルを表に追加する */ @@ -98,7 +101,7 @@ WORD gethex(const char *str); /* アドレスを返す */ /* アドレスには、リテラル/10進定数/16進定数/アドレス定数が含まれる */ -WORD getadr(const char *str, PASS pass); +WORD getadr(const char *prog, const char *str, PASS pass); /* 定数の前に等号(=)をつけて記述される、リテラルを返す */ /* リテラルには、10進定数/16進定数/文字定数が含まれる */ diff --git a/include/casl2.h b/include/casl2.h index e68a24e..fde1207 100644 --- a/include/casl2.h +++ b/include/casl2.h @@ -6,6 +6,7 @@ #include #include #include +#include "hash.h" #define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0])) @@ -17,9 +18,6 @@ enum { DEFAULT_CLOCKS = 5000000, /* デフォルトのクロック周波数。COMET II規格では、未定義 */ }; -/* ハッシュ値を取得する */ -unsigned hash(const char *key, int size); - /* COMET IIの基本データサイズ */ typedef unsigned short WORD; diff --git a/src/Makefile b/src/Makefile index 2edfaa0..de53356 100644 --- a/src/Makefile +++ b/src/Makefile @@ -14,7 +14,7 @@ all: ../casl2 ../comet2 ../dumpword TAGS $(CC) $(CFLAGS) -o $@ $^ %.o: %.c $(CC) -c $(CFLAGS) $< -casl2.o comet2.o $(COMMONSRC) $(ASSRC) $(EXECSRC): $(INCLUDE)/casl2.h +casl2.o comet2.o $(COMMONSRC) $(ASSRC) $(EXECSRC): $(INCLUDE)/casl2.h $(INCLUDE)/hash.h casl2.o $(ASSRC): $(INCLUDE)/assemble.h comet2.o $(EXECSRC): $(INCLUDE)/exec.h TAGS: $(INCLUDE)/*.h *.c diff --git a/src/assemble.c b/src/assemble.c index 0bfc551..bfd15e1 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -72,7 +72,7 @@ WORD gethex(const char *str) /* アドレスを返す アドレスには、リテラル/10進定数/16進定数/アドレス定数が含まれる */ -WORD getadr(const char *str, PASS pass) +WORD getadr(const char *prog, const char *str, PASS pass) { WORD adr = 0x0; if(*str == '=') { @@ -359,7 +359,7 @@ bool cometcmd(const CMDLINE *cmdl, PASS pass) } cmd |= x; } - adr = getadr(cmdl->opd->opdv[1], pass); + adr = getadr(prog, cmdl->opd->opdv[1], pass); writememory(cmd, ptr++, pass); writememory(adr, ptr++, pass); if(cerrno == 0) { @@ -384,7 +384,13 @@ bool cometcmd(const CMDLINE *cmdl, PASS pass) } cmd |= x; } - adr = getadr(cmdl->opd->opdv[0], pass); + /* CALLの場合はプログラムの入口名を表すラベル、 + それ以外の場合は同一プログラム内のラベルを取得 */ + if(cmd == 0x8000) { /* CALL命令 */ + adr = getadr(NULL, cmdl->opd->opdv[0], pass); + } else { + adr = getadr(prog, cmdl->opd->opdv[0], pass); + } writememory(cmd, ptr++, pass); writememory(adr, ptr++, pass); if(cerrno == 0) { diff --git a/src/hash.c b/src/hash.c index b673d53..54f38ab 100644 --- a/src/hash.c +++ b/src/hash.c @@ -1,9 +1,25 @@ +#include "hash.h" + /* ハッシュ値を取得する */ -unsigned hash(const char *key, int size){ - unsigned hashval; +unsigned hash(int keyc, HKEY *keyv[], int tabsize) +{ + int i; + char *p; + unsigned hashval = 0; - for(hashval = 0; *key != '\0'; key++){ - hashval = *key + 31 * hashval; + for(i = 0; i < keyc; i++) { + switch(keyv[i]->type) { + case CHARS: + for(p = keyv[i]->val.s; *p != '\0'; p++) { + hashval = *p + 31 * hashval; + } + break; + case INT: + hashval = keyv[i]->val.i + 31 * hashval; + break; + default: + break; + } } - return hashval % size; + return (hashval % tabsize); } diff --git a/src/label.c b/src/label.c index 035665a..b58def5 100644 --- a/src/label.c +++ b/src/label.c @@ -3,13 +3,32 @@ LABELTAB *labels[LABELTABSIZE]; +/* プログラム名とラベルに対応するハッシュ値を返す */ +unsigned labelhash(const char *prog, const char *label) +{ + HKEY *keys[2]; + int i = 0; + if(prog != NULL) { + keys[i] = malloc(sizeof(HKEY)); + keys[i]->type = CHARS; + keys[i++]->val.s = strdup(prog); + } + keys[i] = malloc(sizeof(HKEY)); + keys[i]->type = CHARS; + keys[i]->val.s = strdup(label); + /* ハッシュ値を返す */ + return hash(i+1, keys, LABELTABSIZE); +} + /* ラベル表からアドレスを検索する */ WORD getlabel(const char *prog, const char *label) { LABELTAB *np; - - for(np = labels[hash(label, LABELTABSIZE)]; np != NULL; np = np->next) { - if(strcmp(label, np->label) == 0) { + for(np = labels[labelhash(prog, label)]; np != NULL; np = np->next) { + if(((prog == NULL && np->prog == NULL) || + (prog != NULL && np->prog != NULL && strcmp(prog, np->prog) == 0)) && + strcmp(label, np->label) == 0) + { return np->adr; } } @@ -21,6 +40,8 @@ bool addlabel(const char *prog, const char *label, WORD adr) { LABELTAB *np; unsigned hashval; + char *keys[2]; + int i = 0; if(getlabel(prog, label) != 0xFFFF) { setcerr(101, label); /* label already defined */ @@ -33,7 +54,11 @@ bool addlabel(const char *prog, const char *label, WORD adr) setcerr(102, NULL); /* label table is full */ return false; } - hashval = hash(label, LABELTABSIZE); + if(prog != NULL) { + keys[i++] = strdup(prog); + } + keys[i] = strdup(label);; + hashval = labelhash(prog, label); np->next = labels[hashval]; labels[hashval] = np; np->adr = adr; diff --git a/src/macro.c b/src/macro.c index ff78dfb..019b956 100644 --- a/src/macro.c +++ b/src/macro.c @@ -22,10 +22,10 @@ bool writeIN(const char *ibuf, const char *len, PASS pass) writememory(0x0, ptr++, pass); /* LAD GR1,IBUF */ writememory(0x1210, ptr++, pass); - writememory(getadr(ibuf, pass), ptr++, pass); + writememory(getadr(prog, ibuf, pass), ptr++, pass); /* LAD GR2,LEN */ writememory(0x1220, ptr++, pass); - writememory(getadr(len, pass), ptr++, pass); + writememory(getadr(prog, len, pass), ptr++, pass); /* SVC 1 */ writememory(0xF000, ptr++, pass); writememory(0x0001, ptr++, pass); @@ -63,10 +63,10 @@ bool writeOUT(const char *obuf, const char *len, PASS pass) writememory(0x0, ptr++, pass); /* LAD GR1,OBUF */ writememory(0x1210, ptr++, pass); - writememory(getadr(obuf, pass), ptr++, pass); + writememory(getadr(prog, obuf, pass), ptr++, pass); /* LD GR2,OLEN */ writememory(0x1020, ptr++, pass); - writememory(getadr(len, pass), ptr++, pass); + writememory(getadr(prog, len, pass), ptr++, pass); /* SVC 2 */ writememory(0xF000, ptr++, pass); writememory(0x0002, ptr++, pass); diff --git a/src/token.c b/src/token.c index fcb1aeb..35ddbf7 100644 --- a/src/token.c +++ b/src/token.c @@ -38,7 +38,7 @@ OPD *opdtok(const char *str) setcerr(121, NULL); /* cannot get operand token */ break; } - if(strlen(p) > OPDSIZE + 2) { + if(strlen(p) > OPDSIZE + 2) { /* OPDSIZE + 「'」2文字分 */ setcerr(118, p); /* operand length is too long */ break; } diff --git a/test/.gitignore b/test/.gitignore index d6850fe..f00c031 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,4 +1,5 @@ 1.txt report.txt diff.txt +err.txt TEST.log diff --git a/test/Makefile.TESTGROUPS.mk b/test/Makefile.TESTGROUPS.mk index 4c12356..b453755 100644 --- a/test/Makefile.TESTGROUPS.mk +++ b/test/Makefile.TESTGROUPS.mk @@ -26,8 +26,6 @@ report: $(LOGFILE) echo "$$success / $$all tests passed. Details in `pwd`/$(LOGFILE)"; \ if test $$success -eq $$all; then \ echo "All tests are succeded."; \ - else \ - grep "Failure" $(LOGFILE); \ fi clean: @for target in $(TESTS); do $(MAKE) clean -C $$target; done @@ -40,7 +38,8 @@ prepare: create: ifdef UNITNAME @mkdir $(UNITNAME) - @echo 'CMD = ' >>$(UNITNAME)/Makefile + @echo 'CMD = ' >>$(UNITNAME)/Makefile; \ + echo 'include ../TEST.mk' >>$(UNITNAME)/Makefile else @echo "no test created. set UNITNAME" endif diff --git a/test/integration/casl2/Makefile b/test/integration/casl2/Makefile index 9f9f2de..1600450 100644 --- a/test/integration/casl2/Makefile +++ b/test/integration/casl2/Makefile @@ -18,7 +18,7 @@ check: done $(LOGFILE): @for target in $(TESTS); do \ - cat <$$target/report.txt >>$(LOGFILE); \ + cat <$$target/report.txt >>$(LOGFILE) || echo $$target ": no report" >>$(LOGFILE); \ done report: $(LOGFILE) @success=`grep "Success" $(LOGFILE) | wc -l`; \ @@ -26,8 +26,6 @@ report: $(LOGFILE) echo "$$success / $$all tests passed. Details in `pwd`/$(LOGFILE)"; \ if test $$success -eq $$all; then \ echo "All tests are succeded."; \ - else \ - grep "Failure" $(LOGFILE); \ fi clean: @for target in $(TESTS); do $(MAKE) clean -C $$target; done diff --git a/test/integration/casl2/cmd_err0/err.txt b/test/integration/casl2/cmd_err0/err.txt deleted file mode 100644 index f2900e0..0000000 --- a/test/integration/casl2/cmd_err0/err.txt +++ /dev/null @@ -1,3 +0,0 @@ -Assemble error - 109: LEA: not command of operand "r1,r2" - ../../../../as/ERR/cmd_err0.casl:4: LEA GR1,GR2 - diff --git a/test/integration/casl2/cmd_err1/err.txt b/test/integration/casl2/cmd_err1/err.txt deleted file mode 100644 index c3c5b79..0000000 --- a/test/integration/casl2/cmd_err1/err.txt +++ /dev/null @@ -1,3 +0,0 @@ -Assemble error - 110: LEA: not command of operand "r,adr[,x]" - ../../../../as/ERR/cmd_err1.casl:2: BEGIN LEA GR1,A - diff --git a/test/integration/casl2/ds_err/err.txt b/test/integration/casl2/ds_err/err.txt deleted file mode 100644 index d6aea6c..0000000 --- a/test/integration/casl2/ds_err/err.txt +++ /dev/null @@ -1,3 +0,0 @@ -Assemble error - 106: operand count mismatch - ../../../../as/ERR/ds_err.casl:4: A DS - diff --git a/test/integration/casl2/labeldup_err/err.txt b/test/integration/casl2/labeldup_err/err.txt deleted file mode 100644 index 9a6d880..0000000 --- a/test/integration/casl2/labeldup_err/err.txt +++ /dev/null @@ -1,3 +0,0 @@ -Assemble error - 101: A: label already defined - ../../../../as/ERR/labeldup_err.casl:6: A DC 1 - diff --git a/test/integration/casl2/opdspc_err/err.txt b/test/integration/casl2/opdspc_err/err.txt deleted file mode 100644 index f088e22..0000000 --- a/test/integration/casl2/opdspc_err/err.txt +++ /dev/null @@ -1,3 +0,0 @@ -Assemble error - 121: cannot get operand token - ../../../../as/ERR/opdspc_err.casl:2: BEGIN LD GR1, A - diff --git a/test/integration/comet2/Makefile b/test/integration/comet2/Makefile index c90f916..b1dd3b0 100644 --- a/test/integration/comet2/Makefile +++ b/test/integration/comet2/Makefile @@ -18,7 +18,7 @@ check: done $(LOGFILE): @for target in $(TESTS); do \ - cat <$$target/report.txt >>$(LOGFILE); \ + cat <$$target/report.txt >>$(LOGFILE) 2>/dev/null || echo "Failure:" $$target "no report" >>$(LOGFILE); \ done report: $(LOGFILE) @success=`grep "Success" $(LOGFILE) | wc -l`; \ @@ -26,8 +26,6 @@ report: $(LOGFILE) echo "$$success / $$all tests passed. Details in `pwd`/$(LOGFILE)"; \ if test $$success -eq $$all; then \ echo "All tests are succeded."; \ - else \ - grep "Failure" $(LOGFILE); \ fi clean: @for target in $(TESTS); do \ diff --git a/test/integration/comet2/TEST.mk b/test/integration/comet2/TEST.mk index 36c64a2..d2174d7 100644 --- a/test/integration/comet2/TEST.mk +++ b/test/integration/comet2/TEST.mk @@ -15,7 +15,7 @@ clean: cleanall: clean @rm -f 0.txt $(OBJFILE) $(OBJFILE): $(CASL2) $(ASFILE) - @$(CASL2) $(CASL2FLAG) -O$(OBJFILE) $(ASFILE) + @$(CASL2) $(CASL2FLAG) -O$(OBJFILE) $(ASFILE) 2>$(ERRFILE) 0.txt 1.txt: $(COMET2) $(OBJFILE) @echo $(CMD) >$@; \ $(CMD) >>$@ 2>$(ERRFILE); \ diff --git a/test/integration/dumpword/Makefile b/test/integration/dumpword/Makefile index 6d8f5f7..c453c20 100644 --- a/test/integration/dumpword/Makefile +++ b/test/integration/dumpword/Makefile @@ -18,7 +18,7 @@ check: done $(LOGFILE): @for target in $(TESTS); do \ - cat <$$target/report.txt >>$(LOGFILE); \ + cat <$$target/report.txt >>$(LOGFILE) || echo $$target ": no report"; \ done report: $(LOGFILE) @success=`grep "Success" $(LOGFILE) | wc -l`; \ @@ -26,8 +26,6 @@ report: $(LOGFILE) echo "$$success / $$all tests passed. Details in `pwd`/$(LOGFILE)"; \ if test $$success -eq $$all; then \ echo "All tests are succeded."; \ - else \ - grep "Failure" $(LOGFILE); \ fi clean: @for target in $(TESTS); do \ diff --git a/test/unit/List.mk b/test/unit/List.mk deleted file mode 100644 index 29e6885..0000000 --- a/test/unit/List.mk +++ /dev/null @@ -1,11 +0,0 @@ -TESTS = \ -cerrtest \ -getcmdcode \ -getcmdtype \ -linetok \ -opdtok \ -print_cmdtype_code \ -print_code_type \ -getgr \ -getint \ -gethex \ diff --git a/test/unit/Makefile b/test/unit/Makefile index 078ca89..7f6bd86 100644 --- a/test/unit/Makefile +++ b/test/unit/Makefile @@ -1,46 +1,47 @@ -include List.mk -LOGFILE = test.log -ifdef UNITNAME - define create - @mkdir $(UNITNAME) - @echo "UNITNAME = $(UNITNAME)" >$(UNITNAME)/Makefile; \ - echo "UCLASS = $(UCLASS)" >>$(UNITNAME)/Makefile; \ - echo "include ../Test.mk" >>$(UNITNAME)/Makefile - @echo "$(UNITNAME) \\" >>List.mk; - @cp Template.c $(UNITNAME)/$(UNITNAME).c; - endef -else - define create - @echo "no test created. set UNITNAME, UCLASS={ AS | EXEC | COMMON }" - endef -endif +# テストグループ +# make : すべてのテストを実施し、ログを作成 +# make all : ↓ +# make clean : すべてのテストで、「make」で生成されたファイルをクリア +# make check : すべてのテストを実施 +# make cleanall: すべてのテストで、「make」と「make prepare」で生成されたファイルをクリア +# make prepare : すべてのテストの、想定結果を出力 +# make create : UNITNAMEで指定されたテストを新規に作成 +TESTS = `ls | grep "^[^A-Z].*"` +LOGFILE = TEST.log -.PHONY: all logclean testclean check prepare -all: logclean check clean report -clean: logclean testclean -logclean: +.PHONY: all check report clean cleanall prepare create +all: check report +check: @rm -f $(LOGFILE) -testclean: @for target in $(TESTS); do \ - $(MAKE) testclean -C $$target; \ + $(MAKE) check -C $$target; \ done -check: $(LOGFILE) $(LOGFILE): @for target in $(TESTS); do \ - $(MAKE) -C $$target; \ + cat <$$target/report.txt >>$(LOGFILE) || echo $$target ": no report"; \ done -prepare: - @for target in $(TESTS) ; do \ - $(MAKE) prepare -C $$target ;\ - done -create: - $(create) report: $(LOGFILE) @success=`grep "Success" $(LOGFILE) | wc -l`; \ - all=`cat $(LOGFILE) | wc -l`; \ - echo "$$success / $$all tests passed."; \ - if test $$success -eq $$all; then \ - echo "All Tests are passed."; \ - else \ - grep "Failure" $(LOGFILE); \ - fi + all=`cat $(LOGFILE) | wc -l`; \ + echo "$$success / $$all tests passed. Details in `pwd`/$(LOGFILE)"; \ + if test $$success -eq $$all; then \ + echo "All tests are succeded."; \ + fi +clean: + @for target in $(TESTS); do $(MAKE) clean -C $$target; done + @rm -f $(LOGFILE) +cleanall: + @for target in $(TESTS); do $(MAKE) cleanall -C $$target; done + @rm -f $(LOGFILE) +prepare: + @for target in $(TESTS) ; do $(MAKE) prepare -C $$target ; done +create: +ifdef UNITNAME + @mkdir $(UNITNAME); \ + echo 'UCLASS = ' >>$(UNITNAME)/Makefile; \ + echo 'TESTSRCFILE = $(UNITNAME).c' >>$(UNITNAME)/Makefile; \ + echo 'include ../TEST.mk' >>$(UNITNAME)/Makefile; \ + cp TEMPLATE.c $(UNITNAME)/$(UNITNAME).c +else + @echo "no test created. set UNITNAME" +endif diff --git a/test/unit/Template.c b/test/unit/Template.c deleted file mode 100644 index 73d0e83..0000000 --- a/test/unit/Template.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include "casl2.h" -#include "assemble.h" -#include "exec.h" - -int main(){ - int i; - WORD r; - char *str[] = { - "str0", "str1", "str2", "str3", "str4", "str5", "str6", ... - }; - for(i = 0; i < sizeof(str)/sizeof(str[0]); i++) { - r = (str[i]); - printf("%s\t0x%04x", str[i], r); - if(cerrno > 0) { - printf("\tError - %d\t%s", cerrno, cerrmsg); - freecerr(); - } - printf("\n"); - } - return 0; -} diff --git a/test/unit/Test.mk b/test/unit/Test.mk deleted file mode 100644 index d027616..0000000 --- a/test/unit/Test.mk +++ /dev/null @@ -1,44 +0,0 @@ -LOGFILE = ../test.log -INCLUDE = ../../../include -CC = gcc -CFLAGS = -g -Wall -I $(INCLUDE) -COMMONSRC = ../../../src/struct.c ../../../src/cmd.c ../../../src/cerr.c -ASSRC = ../../../src/assemble.c ../../../src/token.c ../../../src/label.c ../../../src/macro.c -EXECSRC = ../../../exec.c ../../../dump.c -ifeq "$(UCLASS)" "AS" - SRC = $(COMMONSRC) $(ASSRC) -endif -ifeq "$(UCLASS)" "EXEC" - SRC = $(COMMONSRC) $(EXECSRC) -endif -ifeq "$(UCLASS)" "COMMON" - SRC = $(COMMONSRC) -endif -define report - @echo -n "$(UNITNAME): Test " >$@ - @if test ! -s $^; then \ - echo -n "Success " >>$@; \ - else \ - echo -n "Failure " >>$@; \ - fi - @echo `date +"%F %T"` >>$@ -endef - -.PHPNY: all prepare clean -all: check -prepare: orgclean testclean 0.txt -check: testclean logadd -orgclean: - @rm -f 0.txt -testclean: - @rm -f 1.txt diff.txt report.txt -$(UNITNAME): $(COMMONSRC) $(ASSRC) $(UNITNAME).c - gcc $(CFLAGS) -o $(UNITNAME) $(SRC) $(UNITNAME).c -0.txt 1.txt: $(UNITNAME) - ./$(UNITNAME) >$@ 2>&1 -diff.txt: 1.txt - @-diff 0.txt 1.txt >$@ 2>&1 -report.txt: diff.txt - $(report) -logadd: report.txt - @cat $^ >>$(LOGFILE) diff --git a/test/unit/cerrtest/0.txt b/test/unit/cerrtest/0.txt deleted file mode 100644 index 25998c1..0000000 --- a/test/unit/cerrtest/0.txt +++ /dev/null @@ -1,64 +0,0 @@ -101: (null) - 101 label already defined -102: (null) - 102 label table is full -103: (null) - 103 label not found -104: (null) - 104 label length is too long -105: (null) - 105 no command in the line -106: (null) - 106 operand count mismatch -107: (null) - 107 no label in START -108: (null) - 108 not command of operand "r" -109: (null) - 109 not command of operand "r1,r2" -110: (null) - 110 not command of operand "r,adr[,x]" -111: (null) - 111 not command of operand "adr[,x]" -112: (null) - 112 not command of no operand -113: (null) - 113 command not defined -114: (null) - 114 not integer -115: (null) - 115 not hex -116: (null) - 116 out of hex range -117: (null) - 117 operand is too many -118: (null) - 118 operand length is too long -119: (null) - 119 out of COMET II memory -120: (null) - 120 GR0 in operand x -121: (null) - 121 cannot get operand token -122: (null) - 122 cannot create hash table -123: (null) - 123 unkown error -124: (null) - 124 unkown error -201: (null) - 201 execute - out of COMET II memory -202: (null) - 202 SVC input - out of Input memory -203: (null) - 203 SVC output - out of COMET II memory -204: (null) - 204 Program Register (PR) - out of COMET II memory -205: (null) - 205 Stack Pointer (SP) - cannot allocate stack buffer -206: (null) - 206 unkown error -207: (null) - 207 unkown error -999: (null) - 999 unkown error -101: foobar - 101 foobar: label already defined -102: foobar - 102 foobar: label table is full -103: foobar - 103 foobar: label not found -104: foobar - 104 foobar: label length is too long -105: foobar - 105 foobar: no command in the line -106: foobar - 106 foobar: operand count mismatch -107: foobar - 107 foobar: no label in START -108: foobar - 108 foobar: not command of operand "r" -109: foobar - 109 foobar: not command of operand "r1,r2" -110: foobar - 110 foobar: not command of operand "r,adr[,x]" -111: foobar - 111 foobar: not command of operand "adr[,x]" -112: foobar - 112 foobar: not command of no operand -113: foobar - 113 foobar: command not defined -114: foobar - 114 foobar: not integer -115: foobar - 115 foobar: not hex -116: foobar - 116 foobar: out of hex range -117: foobar - 117 foobar: operand is too many -118: foobar - 118 foobar: operand length is too long -119: foobar - 119 foobar: out of COMET II memory -120: foobar - 120 foobar: GR0 in operand x -121: foobar - 121 foobar: cannot get operand token -122: foobar - 122 foobar: cannot create hash table -123: foobar - 123 foobar: unkown error -124: foobar - 124 foobar: unkown error -201: foobar - 201 foobar: execute - out of COMET II memory -202: foobar - 202 foobar: SVC input - out of Input memory -203: foobar - 203 foobar: SVC output - out of COMET II memory -204: foobar - 204 foobar: Program Register (PR) - out of COMET II memory -205: foobar - 205 foobar: Stack Pointer (SP) - cannot allocate stack buffer -206: foobar - 206 foobar: unkown error -207: foobar - 207 foobar: unkown error -999: foobar - 999 foobar: unkown error diff --git a/test/unit/cerrtest/Makefile b/test/unit/cerrtest/Makefile index ed13e18..6d8b231 100644 --- a/test/unit/cerrtest/Makefile +++ b/test/unit/cerrtest/Makefile @@ -1,3 +1,3 @@ -UNITNAME = cerrtest UCLASS = COMMON -include ../Test.mk +TESTSRCFILE = cerrtest.c +include ../TEST.mk diff --git a/test/unit/getcmdcode/0.txt b/test/unit/getcmdcode/0.txt deleted file mode 100644 index 1469ce1..0000000 --- a/test/unit/getcmdcode/0.txt +++ /dev/null @@ -1,41 +0,0 @@ -LD:000 ---> 0xffff -LD:066 ---> 0xffff -NOEX:020 ---> 0xffff -NOP:000 ---> 0x0000 -LD:011 ---> 0x1000 -ST:010 ---> 0x1100 -LAD:010 ---> 0x1200 -LD:020 ---> 0x1400 -ADDA:011 ---> 0x2000 -SUBA:011 ---> 0x2100 -ADDL:011 ---> 0x2200 -SUBL:011 ---> 0x2300 -ADDA:020 ---> 0x2400 -SUBA:020 ---> 0x2500 -ADDL:020 ---> 0x2600 -SUBL:020 ---> 0x2700 -AND:011 ---> 0x3000 -OR:011 ---> 0x3100 -XOR:011 ---> 0x3200 -AND:020 ---> 0x3400 -OR:020 ---> 0x3500 -XOR:020 ---> 0x3600 -CPA:011 ---> 0x4000 -CPL:011 ---> 0x4100 -CPA:020 ---> 0x4400 -CPL:020 ---> 0x4500 -SLA:010 ---> 0x5000 -SRA:010 ---> 0x5100 -SLL:010 ---> 0x5200 -SRL:010 ---> 0x5300 -JMI:030 ---> 0x6100 -JNZ:030 ---> 0x6200 -JZE:030 ---> 0x6300 -JUMP:030 ---> 0x6400 -JPL:030 ---> 0x6500 -JOV:030 ---> 0x6600 -PUSH:030 ---> 0x7000 -POP:040 ---> 0x7100 -CALL:030 ---> 0x8000 -SVC:030 ---> 0xf000 -RET:000 ---> 0x8100 diff --git a/test/unit/getcmdcode/Makefile b/test/unit/getcmdcode/Makefile index a9aae01..7152e73 100644 --- a/test/unit/getcmdcode/Makefile +++ b/test/unit/getcmdcode/Makefile @@ -1,3 +1,2 @@ -UNITNAME = getcmdcode UCLASS = COMMON -include ../Test.mk +include ../TEST.mk diff --git a/test/unit/getcmdtype/0.txt b/test/unit/getcmdtype/0.txt deleted file mode 100644 index e703388..0000000 --- a/test/unit/getcmdtype/0.txt +++ /dev/null @@ -1,40 +0,0 @@ -0xffff ---> 000 -0x0001 ---> 000 -0x0000 ---> 000 -0x1000 ---> 011 -0x1100 ---> 010 -0x1200 ---> 010 -0x1400 ---> 020 -0x2000 ---> 011 -0x2100 ---> 011 -0x2200 ---> 011 -0x2300 ---> 011 -0x2400 ---> 020 -0x2500 ---> 020 -0x2600 ---> 020 -0x2700 ---> 020 -0x3000 ---> 011 -0x3100 ---> 011 -0x3200 ---> 011 -0x3400 ---> 020 -0x3500 ---> 020 -0x3600 ---> 020 -0x4000 ---> 011 -0x4100 ---> 011 -0x4400 ---> 020 -0x4500 ---> 020 -0x5000 ---> 010 -0x5100 ---> 010 -0x5200 ---> 010 -0x5300 ---> 010 -0x6100 ---> 030 -0x6200 ---> 030 -0x6300 ---> 030 -0x6400 ---> 030 -0x6500 ---> 030 -0x6600 ---> 030 -0x7000 ---> 030 -0x7100 ---> 040 -0x8000 ---> 030 -0xf000 ---> 030 -0x8100 ---> 000 diff --git a/test/unit/getcmdtype/Makefile b/test/unit/getcmdtype/Makefile index bcdbf4a..7152e73 100644 --- a/test/unit/getcmdtype/Makefile +++ b/test/unit/getcmdtype/Makefile @@ -1,3 +1,2 @@ -UNITNAME = getcmdtype UCLASS = COMMON -include ../Test.mk +include ../TEST.mk diff --git a/test/unit/getgr/0.txt b/test/unit/getgr/0.txt deleted file mode 100644 index 8b7ead1..0000000 --- a/test/unit/getgr/0.txt +++ /dev/null @@ -1,30 +0,0 @@ -== Generel Register == - #FFFF -0 #FFFF -aaa #FFFF -GR #FFFF -GR8 #FFFF -GR20 #FFFF -GR0 #0000 -GR1 #0001 -GR2 #0002 -GR3 #0003 -GR4 #0004 -GR5 #0005 -GR6 #0006 -GR7 #0007 -== Index Register == - #FFFF -0 #FFFF -aaa #FFFF -GR #FFFF -GR8 #FFFF -GR20 #FFFF -GR0 #0000 Error - 120 GR0 in operand x -GR1 #0001 -GR2 #0002 -GR3 #0003 -GR4 #0004 -GR5 #0005 -GR6 #0006 -GR7 #0007 diff --git a/test/unit/getgr/Makefile b/test/unit/getgr/Makefile index b60ba14..5ff00b7 100644 --- a/test/unit/getgr/Makefile +++ b/test/unit/getgr/Makefile @@ -1,3 +1,2 @@ -UNITNAME = getgr UCLASS = AS -include ../Test.mk +include ../TEST.mk diff --git a/test/unit/gethex/0.txt b/test/unit/gethex/0.txt deleted file mode 100644 index c78bd62..0000000 --- a/test/unit/gethex/0.txt +++ /dev/null @@ -1,9 +0,0 @@ -#32768 #0000 Error - 122 #32768: out of hex range -#-1 #0000 Error - 122 #-1: out of hex range -#G #0000 Error - 115 #G: not hex -#FFFF #FFFF -#0 #0000 -#1 #0001 -#ab #00AB -#AB #00AB -#20 #0020 diff --git a/test/unit/gethex/Makefile b/test/unit/gethex/Makefile index 4c1a060..5ff00b7 100644 --- a/test/unit/gethex/Makefile +++ b/test/unit/gethex/Makefile @@ -1,3 +1,2 @@ -UNITNAME = gethex UCLASS = AS -include ../Test.mk +include ../TEST.mk diff --git a/test/unit/getint/0.txt b/test/unit/getint/0.txt deleted file mode 100644 index c3db13f..0000000 --- a/test/unit/getint/0.txt +++ /dev/null @@ -1,13 +0,0 @@ -0 0x0000 -01 0x0001 -1a 0x0000 Error - 114 1a: not integer --5G 0x0000 Error - 114 -5G: not integer -123 0x007b -32767 0x7fff -32768 0x0000 -32769 0x0001 --1 0xffff --2345 0xf6d7 --32768 0x8000 --32769 0xffff --32770 0xfffe diff --git a/test/unit/getint/Makefile b/test/unit/getint/Makefile index e22129c..5ff00b7 100644 --- a/test/unit/getint/Makefile +++ b/test/unit/getint/Makefile @@ -1,3 +1,2 @@ -UNITNAME = getint UCLASS = AS -include ../Test.mk +include ../TEST.mk diff --git a/test/unit/linetok/0.txt b/test/unit/linetok/0.txt deleted file mode 100644 index b83e906..0000000 --- a/test/unit/linetok/0.txt +++ /dev/null @@ -1,54 +0,0 @@ -0: IOTEST START -cl->label: IOTEST -cl->cmd: START -cl->opdc: 0 - -1: OUT OBUF1,OLEN1 -cl->cmd: OUT -cl->opdc: 2 -cl->opdv[0]: OBUF1 -cl->opdv[1]: OLEN1 - -2: OUT OBUF2,OLEN2 ;comment -cl->cmd: OUT -cl->opdc: 2 -cl->opdv[0]: OBUF2 -cl->opdv[1]: OLEN2 - -3: OUT OBUF1,OLEN1 -cl->cmd: OUT -cl->opdc: 2 -cl->opdv[0]: OBUF1 -cl->opdv[1]: OLEN1 - -4: OUT OBUF1,OLEN1 -cl->cmd: OUT -cl->opdc: 2 -cl->opdv[0]: OBUF1 -cl->opdv[1]: OLEN1 - -5: OUT OBUF2,OLEN2 -cl->cmd: OUT -cl->opdc: 2 -cl->opdv[0]: OBUF2 -cl->opdv[1]: OLEN2 - -6: OUT OBUF1, OLEN1 -cl->cmd: OUT -cl->opdc: 1 -cl->opdv[0]: OBUF1 - error - 121: cannot get operand token - -7: BEGIN LD GR1, A -cl->label: BEGIN -cl->cmd: LD -cl->opdc: 1 -cl->opdv[0]: GR1 - error - 121: cannot get operand token - -8: -cl is NULL - -9: ;comment -cl is NULL - diff --git a/test/unit/linetok/Makefile b/test/unit/linetok/Makefile index f596cdf..e24b848 100644 --- a/test/unit/linetok/Makefile +++ b/test/unit/linetok/Makefile @@ -1,3 +1,3 @@ -UNITNAME = linetok UCLASS = AS -include ../Test.mk +TESTSRCFILE = linetok.c +include ../TEST.mk diff --git a/test/unit/opdtok/0.txt b/test/unit/opdtok/0.txt deleted file mode 100644 index 7bb505e..0000000 --- a/test/unit/opdtok/0.txt +++ /dev/null @@ -1,137 +0,0 @@ - -OPDC:0 - -GR0,GR1 -OPDC:2 -OPDC[0]:GR0 -OPDC[1]:GR1 - -GR0,A -OPDC:2 -OPDC[0]:GR0 -OPDC[1]:A - -GR1,12 -OPDC:2 -OPDC[0]:GR1 -OPDC[1]:12 - -GR0,0,GR1 -OPDC:3 -OPDC[0]:GR0 -OPDC[1]:0 -OPDC[2]:GR1 - -'aaa',0 -OPDC:2 -OPDC[0]:'aaa' -OPDC[1]:0 - -'aaa','bbb' -OPDC:2 -OPDC[0]:'aaa' -OPDC[1]:'bbb' - -'aaa'',''bbb' -OPDC:1 -OPDC[0]:'aaa'',''bbb' - -'aaa,bbb' -OPDC:1 -OPDC[0]:'aaa,bbb' - -1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0 -OPDC:40 -OPDC[0]:1 -OPDC[1]:2 -OPDC[2]:3 -OPDC[3]:4 -OPDC[4]:5 -OPDC[5]:6 -OPDC[6]:7 -OPDC[7]:8 -OPDC[8]:9 -OPDC[9]:0 -OPDC[10]:1 -OPDC[11]:2 -OPDC[12]:3 -OPDC[13]:4 -OPDC[14]:5 -OPDC[15]:6 -OPDC[16]:7 -OPDC[17]:8 -OPDC[18]:9 -OPDC[19]:0 -OPDC[20]:1 -OPDC[21]:2 -OPDC[22]:3 -OPDC[23]:4 -OPDC[24]:5 -OPDC[25]:6 -OPDC[26]:7 -OPDC[27]:8 -OPDC[28]:9 -OPDC[29]:0 -OPDC[30]:1 -OPDC[31]:2 -OPDC[32]:3 -OPDC[33]:4 -OPDC[34]:5 -OPDC[35]:6 -OPDC[36]:7 -OPDC[37]:8 -OPDC[38]:9 -OPDC[39]:0 - -1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1 -OPDC:40 -OPDC[0]:1 -OPDC[1]:2 -OPDC[2]:3 -OPDC[3]:4 -OPDC[4]:5 -OPDC[5]:6 -OPDC[6]:7 -OPDC[7]:8 -OPDC[8]:9 -OPDC[9]:0 -OPDC[10]:1 -OPDC[11]:2 -OPDC[12]:3 -OPDC[13]:4 -OPDC[14]:5 -OPDC[15]:6 -OPDC[16]:7 -OPDC[17]:8 -OPDC[18]:9 -OPDC[19]:0 -OPDC[20]:1 -OPDC[21]:2 -OPDC[22]:3 -OPDC[23]:4 -OPDC[24]:5 -OPDC[25]:6 -OPDC[26]:7 -OPDC[27]:8 -OPDC[28]:9 -OPDC[29]:0 -OPDC[30]:1 -OPDC[31]:2 -OPDC[32]:3 -OPDC[33]:4 -OPDC[34]:5 -OPDC[35]:6 -OPDC[36]:7 -OPDC[37]:8 -OPDC[38]:9 -OPDC[39]:0 -Error - 117: operand is too many - -'1234567890123456789012345678901234567890' -OPDC:1 -OPDC[0]:'1234567890123456789012345678901234567890' - -'12345678901234567890123456789012345678901' -OPDC:0 -Error - 118: '12345678901234567890123456789012345678901': operand length is too long - diff --git a/test/unit/print_cmdtype_code/0.txt b/test/unit/print_cmdtype_code/0.txt deleted file mode 100644 index 4c2d87a..0000000 --- a/test/unit/print_cmdtype_code/0.txt +++ /dev/null @@ -1,39 +0,0 @@ -== CMDTYPE_CODE TABLE == -( 0) - SVC 030 #F000 -( 1) - JZE 030 #6300 -( 1) - SLL 010 #5200 -( 2) - SLA 010 #5000 -( 3) - ADDL 011 #2200 -( 3) - NOP 000 #0000 -( 4) - ADDA 011 #2000 -( 7) - OR 020 #3500 -(10) - CALL 030 #8000 -(11) - ADDL 020 #2600 -(12) - ADDA 020 #2400 -(13) - RET 000 #8100 -(14) - SUBL 011 #2300 -(15) - SUBA 011 #2100 -(19) - LAD 010 #1200 -(20) - JMI 030 #6100 -(21) - AND 011 #3000 -(22) - JUMP 030 #6400 -(22) - SUBL 020 #2700 -(23) - CPL 011 #4100 -(23) - SUBA 020 #2500 -(24) - CPA 011 #4000 -(25) - XOR 011 #3200 -(26) - JNZ 030 #6200 -(26) - LD 011 #1000 -(27) - JOV 030 #6600 -(29) - SRL 010 #5300 -(29) - AND 020 #3400 -(29) - ST 010 #1100 -(30) - SRA 010 #5100 -(31) - CPL 020 #4500 -(32) - JPL 030 #6500 -(32) - CPA 020 #4400 -(33) - POP 040 #7100 -(33) - XOR 020 #3600 -(34) - PUSH 030 #7000 -(34) - LD 020 #1400 -(37) - OR 011 #3100 diff --git a/test/unit/print_cmdtype_code/Makefile b/test/unit/print_cmdtype_code/Makefile index f9cbe5b..4687747 100644 --- a/test/unit/print_cmdtype_code/Makefile +++ b/test/unit/print_cmdtype_code/Makefile @@ -1,3 +1,3 @@ -UNITNAME = print_cmdtype_code +TESTSRCFILE = print_cmdtype_code.c UCLASS = COMMON -include ../Test.mk +include ../TEST.mk diff --git a/test/unit/print_code_type/0.txt b/test/unit/print_code_type/0.txt deleted file mode 100644 index 67b1eb0..0000000 --- a/test/unit/print_code_type/0.txt +++ /dev/null @@ -1,39 +0,0 @@ -== CODE_TYPE TABLE == -( 0) - #2600 020 ADDL -( 0) - #0000 000 NOP -( 1) - #2700 020 SUBL -( 4) - #5000 010 SLA -( 5) - #5100 010 SRA -( 6) - #5200 010 SLL -( 7) - #5300 010 SRL -(10) - #3000 011 AND -(11) - #3100 011 OR -(12) - #F000 030 SVC -(12) - #3200 011 XOR -(14) - #8000 030 CALL -(14) - #3400 020 AND -(15) - #8100 000 RET -(15) - #3500 020 OR -(16) - #3600 020 XOR -(16) - #1000 011 LD -(17) - #1100 010 ST -(18) - #1200 010 LAD -(20) - #1400 020 LD -(21) - #6100 030 JMI -(22) - #6200 030 JNZ -(23) - #6300 030 JZE -(24) - #6400 030 JUMP -(25) - #6500 030 JPL -(26) - #6600 030 JOV -(26) - #4000 011 CPA -(27) - #4100 011 CPL -(30) - #4400 020 CPA -(31) - #4500 020 CPL -(32) - #2000 011 ADDA -(33) - #2100 011 SUBA -(34) - #2200 011 ADDL -(35) - #2300 011 SUBL -(36) - #7000 030 PUSH -(36) - #2400 020 ADDA -(37) - #7100 040 POP -(37) - #2500 020 SUBA diff --git a/test/unit/print_code_type/Makefile b/test/unit/print_code_type/Makefile index bffa8c6..57c87c3 100644 --- a/test/unit/print_code_type/Makefile +++ b/test/unit/print_code_type/Makefile @@ -1,3 +1,3 @@ -UNITNAME = print_code_type UCLASS = COMMON -include ../Test.mk +TESTSRCFILE = print_code_type.c +include ../TEST.mk