From 6eb54846c27b216d7602a5107d9383f8f4324d71 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Thu, 17 Mar 2011 00:20:55 +0900 Subject: [PATCH] =?utf8?q?Valgrind=E3=81=A7=E8=A6=8B=E3=81=A4=E3=81=8B?= =?utf8?q?=E3=81=A3=E3=81=9F=E3=83=A1=E3=83=A2=E3=83=AA=E3=83=BC=E5=91=A8?= =?utf8?q?=E8=BE=BA=E3=81=AE=E5=95=8F=E9=A1=8C=E7=82=B9=E3=82=92=E4=BF=AE?= =?utf8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/cerr.h | 2 +- include/cmem.h | 11 +++-- include/exec.h | 7 ++- include/word.h | 2 +- src/assemble.c | 62 ++++++++++++------------- src/casl2.c | 6 +-- src/cerr.c | 32 ++++++------- src/cmd.c | 16 ++++--- src/cmem.c | 9 ---- src/comet2.c | 9 +--- src/exec.c | 24 ++++++++-- src/label.c | 50 +++++++++++--------- src/struct.c | 8 ++-- src/token.c | 91 +++++++++++++++++++------------------ src/word.c | 6 +-- test/unit/addcerrlist/0.txt | 28 ++++++------ test/unit/getcmdtype/0.txt | 4 +- 17 files changed, 188 insertions(+), 179 deletions(-) diff --git a/include/cerr.h b/include/cerr.h index a67b65d..5ff200c 100644 --- a/include/cerr.h +++ b/include/cerr.h @@ -43,7 +43,7 @@ void cerr_init(); /** * エラーリストを作成・追加する */ -bool addcerrlist(int cerrc, CERR cerrv[]); +void addcerrlist(int cerrc, CERR cerrv[]); /** * エラーリストを表示する diff --git a/include/cmem.h b/include/cmem.h index a38c81d..c670226 100644 --- a/include/cmem.h +++ b/include/cmem.h @@ -9,6 +9,13 @@ #define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0])) #endif +/** + * メモリを解放 + */ +#ifndef FREE +#define FREE(ptr) {free(ptr); ptr = NULL;} +#endif + /** * mallocを実行し、0で初期化 * メモリを確保できない場合はエラーを出力して終了 @@ -26,8 +33,4 @@ void *calloc_chk(size_t nmemb, size_t size, char *tag); */ char *strdup_chk(const char *s, char *tag); -/** - * メモリを解放 - */ -void free_chk(void *ptr, char *tag); #endif diff --git a/include/exec.h b/include/exec.h index 83ce07f..f0788df 100644 --- a/include/exec.h +++ b/include/exec.h @@ -26,7 +26,12 @@ extern EXECMODE execmode; /** * 実行エラーをエラーリストに追加 */ -bool addcerrlist_exec(); +void addcerrlist_exec(); + +/** + * アセンブル結果読み込みエラーをエラーリストに追加 + */ +void addcerrlist_load(); /** * 指定されたファイルからアセンブル結果を読み込む diff --git a/include/word.h b/include/word.h index 93669dc..647f8a4 100644 --- a/include/word.h +++ b/include/word.h @@ -9,7 +9,7 @@ typedef unsigned short WORD; /** * wordのエラーをエラーリストに追加 */ -bool addcerrlist_word(); +void addcerrlist_word(); /** * 10進数または16進数の文字列をWORD値に変換 diff --git a/src/assemble.c b/src/assemble.c index f9d2ea7..0e29454 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -165,8 +165,7 @@ bool assemblecmd(const CMDLINE *cmdl, PASS pass) else if(pass == SECOND) { execptr->end = asptr->lptr; } - /* プログラム名のクリア */ - asptr->prog = NULL; + FREE(asptr->prog); status = true; break; case DS: @@ -268,7 +267,7 @@ void writeIN(const char *ibuf, const char *len, PASS pass) assembleline(" POP GR2", pass); assembleline(" POP GR1", pass); - free_chk(line, "writeIN.line"); + FREE(line); } /** @@ -300,7 +299,7 @@ void writeOUT(const char *obuf, const char *len, PASS pass) assembleline(" SVC 2", pass); assembleline(" POP GR2", pass); assembleline(" POP GR1", pass); - free_chk(line, "writeOUT.line"); + FREE(line); } /** マクロ命令「RPUSH」をメモリに書き込む @@ -321,7 +320,7 @@ void writeRPUSH(PASS pass) sprintf(line, " PUSH 0,GR%d", i); assembleline(line, pass); } - free_chk(line, "writeRPUSH.line"); + FREE(line); } /** @@ -344,7 +343,7 @@ void writeRPOP(PASS pass) sprintf(line, " POP GR%d", i); assembleline(line, pass); } - free_chk(line, "writeRPOP.line"); + FREE(line); } /** @@ -525,17 +524,15 @@ void writeDC(const char *str, PASS pass) } /** - * 1行をアセンブル + * トークンをアセンブル */ bool assembletok(const CMDLINE *cmdl, PASS pass) { bool status = false; + /* 命令がない場合 */ if(cmdl->cmd == NULL){ - /* ラベルが定義されていて命令がない場合はエラー */ - if(cmdl->label != NULL) { - setcerr(105, NULL); /* no command in the line */ - } + ; } /* アセンブラ命令の処理 */ else if(cerr->num == 0 && assemblecmd(cmdl, pass) == true) { @@ -595,18 +592,31 @@ WORD getadr(const char *prog, const char *str, PASS pass) bool assembleline(const char *line, PASS pass) { CMDLINE *cmdl; + bool status = true; + int i; - if((cmdl = linetok(line)) != NULL) { - if(pass == FIRST && cmdl->label != NULL) { - if(addlabel(asptr->prog, cmdl->label, asptr->ptr) == false) { - return false; + cmdl = linetok(line); + status = (cerr->num == 0) ? true : false; + if(cmdl != NULL) { + if(status == true) { + if(pass == FIRST && cmdl->label != NULL) { + status = addlabel(asptr->prog, cmdl->label, asptr->ptr); } + if(status == true) { + status = assembletok(cmdl, pass); + } + FREE(cmdl->label); } - if(assembletok(cmdl, pass) == false) { - return false; + if(cmdl->opd != NULL) { + for(i = 0; i < cmdl->opd->opdc; i++) { + FREE(cmdl->opd->opdv[i]); + } } + FREE(cmdl->opd); + FREE(cmdl->cmd); } - return true; + FREE(cmdl); + return status; } /** @@ -627,20 +637,14 @@ bool assemble(const char *file, PASS pass) { int lineno = 0; bool status = true; - CMDLINE *cmdl; - char *line; + char *line = malloc_chk(LINESIZE + 1, "line"); FILE *fp; if((fp = fopen(file, "r")) == NULL) { perror(file); return false; } - for(; ;) { - cmdl = malloc_chk(sizeof(CMDLINE), "cmdl"); - line = malloc_chk(LINESIZE + 1, "line"); - if((line = fgets(line, LINESIZE, fp)) == NULL) { - break; - } + while(fgets(line, LINESIZE, fp)) { lineno++; if((pass == FIRST && asmode.src == true) || (pass == SECOND && asmode.asdetail == true)) @@ -650,17 +654,13 @@ bool assemble(const char *file, PASS pass) if(assembleline(line, pass) == false) { break; } - if(cerr->num > 0) { - break; - } - free_chk(line, "line"); - free_chk(cmdl, "cmdl"); } if(cerr->num > 0) { fprintf(stderr, "Assemble error - %d: %s\n", cerr->num, cerr->msg); printline(stderr, file, lineno, line); status = false; } + FREE(line); fclose(fp); return status; } diff --git a/src/casl2.c b/src/casl2.c index 75902c3..c272d05 100644 --- a/src/casl2.c +++ b/src/casl2.c @@ -144,7 +144,6 @@ int main(int argc, char *argv[]) } else if(pass == SECOND) { asptr->ptr = beginptr[i]; } - asptr->prog = NULL; if(execmode.trace == true || execmode.dump == true || asmode.src == true || asmode.label == true || asmode.asdetail == true) { @@ -164,15 +163,14 @@ int main(int argc, char *argv[]) } if(pass == SECOND) { freelabel(); /* ラベルハッシュ表を解放 */ - free_chk(asptr->prog, "asptr.prog"); /* プログラム名を解放 */ - free_chk(asptr, "asptr"); /* アセンブル時のプロパティを解放 */ free_cmdtype_code(); /* 命令の名前とタイプがキーのハッシュ表を解放 */ + FREE(asptr); /* アセンブル時のプロパティを解放 */ } } if(res == true) { if(objfile != NULL) { outassemble(objfile); - free_chk(objfile, "objfile"); + FREE(objfile); } if(asmode.onlyassemble == false) { create_code_type(); /* 命令のコードとタイプがキーのハッシュ表を作成 */ diff --git a/src/cerr.c b/src/cerr.c index 24f620d..d595275 100644 --- a/src/cerr.c +++ b/src/cerr.c @@ -22,32 +22,28 @@ CERR *cerr; /** * エラーリスト */ -CERRLIST *cerrlist; +CERRLIST *cerrlist = NULL; /** * エラーリストを作成または追加する */ -bool addcerrlist(int newerrc, CERR newerrv[]) +void addcerrlist(int newerrc, CERR newerrv[]) { int i; - CERRLIST *p, *q; + CERRLIST *p = NULL, *q; assert(newerrc > 0 && newerrv != NULL); - if(cerrlist == NULL) { - p = cerrlist = malloc_chk(sizeof(CERRLIST), "cerrlist"); - } else { - for(p = cerrlist; p != NULL; p = p->next) { - q = p; - } - p = q->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next"); - } for(i = 0; i < newerrc; i++) { + if(p == NULL) { + p = q = malloc_chk(sizeof(CERRLIST), "cerrlist"); + } else { + p = p->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next"); + } p->cerr = &newerrv[i]; - q = p; - p = p->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next"); + p->next = NULL; } - q->next = NULL; - return true; + p->next = cerrlist; + cerrlist = q; } /** @@ -107,12 +103,12 @@ void freecerr() CERRLIST *p = cerrlist, *q; /* 現在のエラーメッセージを解放 */ - free_chk(cerr->msg, "cerr.msg"); + FREE(cerr->msg); /* 現在のエラーを解放 */ - free_chk(cerr, "cerr"); + FREE(cerr); /* エラーリストを解放 */ for(p = cerrlist; p != NULL; p = q) { q = p->next; - free_chk(p, "freecerr.p"); + FREE(p); } } diff --git a/src/cmd.c b/src/cmd.c index 1b01d63..870d975 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -82,9 +82,9 @@ unsigned hash_cmdtype(const char *cmd, CMDTYPE type) keys[1]->val.i = (int)(type & 070); /* ハッシュ値の計算 */ hashval = hash(2, keys, cmdtabsize); - free_chk(keys[0]->val.s, "keys[0].val.s"); - free_chk(keys[0], "keys[0]"); - free_chk(keys[1], "keys[1]"); + FREE(keys[0]->val.s); + FREE(keys[0]); + FREE(keys[1]); /* ハッシュ値を返す */ return hashval; } @@ -140,7 +140,7 @@ void free_cmdtype_code() for(i = 0; i < cmdtabsize; i++) { for(p = cmdtype_code[i]; p != NULL; p = q) { q = p->next; - free_chk(p, "free_cmdtype_code"); + FREE(p); } } } @@ -151,13 +151,15 @@ void free_cmdtype_code() unsigned hash_code(WORD code) { HKEY *keys[1]; + unsigned h; /* 命令コードを設定 */ keys[0] = malloc_chk(sizeof(HKEY), "hash_code.key"); keys[0]->type = INT; keys[0]->val.i = (int)(code >> 8); - /* ハッシュ値を返す */ - return hash(1, keys, cmdtabsize); + h = hash(1, keys, cmdtabsize); + FREE(keys[0]); + return h; } /** @@ -209,7 +211,7 @@ void free_code_type() for(i = 0; i < cmdtabsize; i++) { for(p = code_type[i]; p != NULL; p = q) { q = p->next; - free_chk(p, "code_type"); + FREE(p); } } } diff --git a/src/cmem.c b/src/cmem.c index 2274c2e..73ab512 100644 --- a/src/cmem.c +++ b/src/cmem.c @@ -47,12 +47,3 @@ char *strdup_chk(const char *s, char *tag) strcpy(t, s); return t; } - -/** - * メモリを解放 - */ -void free_chk(void *ptr, char *tag) -{ - free(ptr); - ptr = NULL; -} diff --git a/src/comet2.c b/src/comet2.c index 3d429d1..b68b093 100644 --- a/src/comet2.c +++ b/src/comet2.c @@ -21,13 +21,6 @@ static struct option longopts[] = { {0, 0, 0, 0}, }; -/** - * comet2コマンドのエラー - */ -static CERR cerr_comet2[] = { - { 208, "object file is not specified" }, -}; - /** * comet2コマンドのメイン */ @@ -38,7 +31,7 @@ int main(int argc, char *argv[]) const char *usage = "Usage: %s [-tTdh] [-M ] [-C ] FILE\n"; cerr_init(); - addcerrlist(ARRAYSIZE(cerr_comet2), cerr_comet2); + addcerrlist_load(); addcerrlist_exec(); /* オプションの処理 */ diff --git a/src/exec.c b/src/exec.c index 8530640..feb735c 100644 --- a/src/exec.c +++ b/src/exec.c @@ -9,7 +9,6 @@ * 実行エラーの定義 */ static CERR cerr_exec[] = { - { 201, "Loading - full of COMET II memory" }, { 202, "SVC input - out of Input memory" }, { 203, "SVC output - out of COMET II memory" }, { 204, "Program Register (PR) - out of COMET II memory" }, @@ -20,19 +19,34 @@ static CERR cerr_exec[] = { { 210, "not command code of COMET II" }, }; +/** + * アセンブル結果読み込みエラーの定義 + */ +static CERR cerr_load[] = { + { 201, "Loading - full of COMET II memory" }, + { 208, "object file is not specified" }, +}; + /** * 実行モード: trace, logical, dump */ EXECMODE execmode = {false, false, false}; /** - * 実行エラーをエラーリストに追加 + * アセンブル結果読み込みエラーをエラーリストに追加 */ -bool addcerrlist_exec() +void addcerrlist_load() { - return addcerrlist(ARRAYSIZE(cerr_exec), cerr_exec); + addcerrlist(ARRAYSIZE(cerr_load), cerr_load); } +/** + * 実行エラーをエラーリストに追加 + */ +void addcerrlist_exec() +{ + addcerrlist(ARRAYSIZE(cerr_exec), cerr_exec); +} /** * 指定されたファイルからアセンブル結果を読み込む */ @@ -81,7 +95,7 @@ static void svcin() sys->memory[sys->cpu->gr[1]+i] = *(buffer + i); } sys->memory[sys->cpu->gr[2]] = i + 1; - free_chk(buffer, "buffer"); + FREE(buffer); } /** diff --git a/src/label.c b/src/label.c index a36231b..a8baa1d 100644 --- a/src/label.c +++ b/src/label.c @@ -17,18 +17,24 @@ static LABELTAB *labels[LABELTABSIZE]; /* ラベル表 */ unsigned labelhash(const char *prog, const char *label) { HKEY *keys[2]; - int i = 0; + int i = 0, j; + unsigned h; if(prog != NULL) { - keys[i] = malloc_chk(sizeof(HKEY), "labelhash.key[]"); + keys[i] = malloc_chk(sizeof(HKEY), "labelhash.key"); keys[i]->type = CHARS; - keys[i]->val.s = strdup_chk(prog, "labelhash.key[].val"); + keys[i]->val.s = strdup_chk(prog, "labelhash.key.val"); + i++; } - keys[i] = malloc_chk(sizeof(HKEY), "labelhash.key[]"); + keys[i] = malloc_chk(sizeof(HKEY), "labelhash.key"); keys[i]->type = CHARS; - keys[i]->val.s = strdup_chk(label, "labelhash.key[].val"); - /* ハッシュ値を返す */ - return hash(i+1, keys, LABELTABSIZE); + keys[i]->val.s = strdup_chk(label, "labelhash.key.val"); + h = hash(i+1, keys, LABELTABSIZE); + for(j = 0; j < i + 1; j++) { + FREE(keys[j]->val.s); + FREE(keys[j]); + } + return h; } /** @@ -37,13 +43,13 @@ unsigned labelhash(const char *prog, const char *label) WORD getlabel(const char *prog, const char *label) { assert(label != NULL); - LABELTAB *np; + LABELTAB *p; - for(np = labels[labelhash(prog, label)]; np != NULL; np = np->next) { - if((prog == NULL || (np->prog != NULL && strcmp(prog, np->prog) == 0)) && - strcmp(label, np->label) == 0) + for(p = labels[labelhash(prog, label)]; p != NULL; p = p->next) { + if((prog == NULL || (p->prog != NULL && strcmp(prog, p->prog) == 0)) && + strcmp(label, p->label) == 0) { - return np->adr; + return p->adr; } } return 0xFFFF; @@ -98,20 +104,20 @@ int compare_adr(const void *a, const void *b) void printlabel() { int i, asize = 0; - LABELTAB *np; + LABELTAB *p; LABELARRAY *ar[labelcnt]; for(i = 0; i < LABELTABSIZE; i++) { - for(np = labels[i]; np != NULL; np = np->next) { - assert(np->label != NULL); + for(p = labels[i]; p != NULL; p = p->next) { + assert(p->label != NULL); ar[asize] = malloc_chk(sizeof(LABELARRAY), "ar[]"); - if(np->prog == NULL) { + if(p->prog == NULL) { ar[asize]->prog = NULL; } else { - ar[asize]->prog = strdup_chk(np->prog, "ar[].prog"); + ar[asize]->prog = strdup_chk(p->prog, "ar[].prog"); } - ar[asize]->label = strdup_chk(np->label, "ar[].label"); - ar[asize++]->adr = np->adr; + ar[asize]->label = strdup_chk(p->label, "ar[].label"); + ar[asize++]->adr = p->adr; } } qsort(ar, asize, sizeof(*ar), compare_adr); @@ -134,9 +140,9 @@ void freelabel() for(i = 0; i < LABELTABSIZE; i++) { for(p = labels[i]; p != NULL; p = q) { q = p->next; - free_chk(p->prog, "freelabel.p.prog"); - free_chk(p->label, "freelabel.p.label"); - free_chk(p, "freelabel.p"); + FREE(p->prog); + FREE(p->label); + FREE(p); } } } diff --git a/src/struct.c b/src/struct.c index 0662eff..ef9a844 100644 --- a/src/struct.c +++ b/src/struct.c @@ -40,8 +40,8 @@ void reset(int memsize, int clocks) */ void shutdown() { - free_chk(execptr, "execptr"); - free_chk(sys->memory, "sys.memory"); - free_chk(sys->cpu, "sys.cpu"); - free_chk(sys, "sys"); + FREE(execptr); + FREE(sys->memory); + FREE(sys->cpu); + FREE(sys); } diff --git a/src/token.c b/src/token.c index c185d8d..c7bfade 100644 --- a/src/token.c +++ b/src/token.c @@ -46,7 +46,7 @@ OPD *opdtok(const char *str) if(str == NULL) { return opd; } - p = q = r = strdup_chk(str, "opdtopk.p"); + p = q = r = strdup_chk(str, "opdtok.p"); do { /* オペランド数が多すぎる場合はエラー */ if(opd->opdc >= OPDSIZE) { @@ -92,7 +92,7 @@ OPD *opdtok(const char *str) rcnt = 0; } } while(sepc == ','); - free_chk(p, "opdtok.p"); + FREE(p); return opd; } @@ -103,7 +103,7 @@ CMDLINE *linetok(const char *line) { char *tokens, *p, *sepp; bool quoting = false; - CMDLINE *cmdl = malloc_chk(sizeof(CMDLINE), "cmdl"); + CMDLINE *cmdl = NULL; if(line == NULL || strlen(line) == 0) { return NULL; @@ -119,50 +119,51 @@ CMDLINE *linetok(const char *line) break; } } - if(*tokens == '\0') { - return NULL; - } - p = tokens; - /* 行の先頭が空白またはタブの場合、ラベルは空 */ - if((sepp = p + strcspn(p, " \t\n")) == p){ - cmdl->label = NULL; - } else { /* ラベルを取得 */ - *sepp = '\0'; - /* 文字列が長すぎる場合はエラー */ - if(strlen(p) > LABELSIZE) { - setcerr(104, p); /* label length is too long */ + if(*tokens != '\0') { + p = tokens; + cmdl = malloc_chk(sizeof(CMDLINE), "cmdl"); + /* ラベルの取得。行の先頭が空白またはタブの場合、ラベルは空 */ + if((sepp = p + strcspn(p, " \t\n")) == p){ + cmdl->label = NULL; + } else { /* ラベルを取得 */ + *sepp = '\0'; + /* 文字列が長すぎる場合はエラー */ + if(strlen(p) > LABELSIZE) { + setcerr(104, p); /* label length is too long */ + } + cmdl->label = strdup_chk(p, "cmdl.label"); + p = sepp + 1; } - cmdl->label = strdup_chk(p, "cmdl.label"); - p = sepp + 1; - } - while(*p == ' ' || *p == '\t') { - p++; - } - /* 命令がない場合、終了 */ - if(*p == '\n' || *p == '\0') { - /* ラベルが定義されていて命令がない場合はエラー */ - if(cmdl->label != NULL) { - setcerr(105, NULL); /* no command in the line */ + /* ラベルと命令の間の空白をスキップ */ + while(*p == ' ' || *p == '\t') { + p++; + } + /* 命令とオペランドの取得 */ + if(*p == '\n' || *p == '\0') { /* 命令がない場合は、終了 */ + if(cmdl->label != NULL) { /* ラベルが定義されていて命令がない場合はエラー */ + setcerr(105, NULL); /* no command in the line */ + } + } else { + /* 命令の取得 */ + sepp = p + strcspn(p, " \t\n"); + *sepp = '\0'; + cmdl->cmd = strdup_chk(p, "cmdl.cmd"); + p = sepp + 1; + /* 命令とオペランドの間の空白をスキップ */ + while(*p == ' ' || *p == '\t') { + p++; + } + /* 改行かタブまでの文字列を取得。 + 「'」で囲まれた文字列に含まれる場合があるため、空白は無視 */ + if((sepp = p + strcspn(p, "\t\n")) > p) { + *sepp = '\0'; + cmdl->opd = opdtok(p); + } else { + cmdl->opd = malloc_chk(sizeof(OPD *), "cmdl.opd"); + cmdl->opd->opdc = 0; + } } - return NULL; - } - /* 命令を取得 */ - sepp = p + strcspn(p, " \t\n"); - *sepp = '\0'; - cmdl->cmd = strdup_chk(p, "cmdl.cmd"); - p = sepp + 1; - while(*p == ' ' || *p == '\t') { - p++; - } - /* オペランドを取得 */ - cmdl->opd = malloc_chk(sizeof(OPD), "cmdl.opd"); - /* 改行かタブまでの文字列を取得。 - 「'」で囲まれた文字列に含まれる場合があるため、空白は無視 */ - if((sepp = p + strcspn(p, "\t\n")) > p) { - *sepp = '\0'; - cmdl->opd = opdtok(p); - } else { - cmdl->opd->opdc = 0; } + FREE(tokens); return cmdl; } diff --git a/src/word.c b/src/word.c index 1bbffdb..925946b 100644 --- a/src/word.c +++ b/src/word.c @@ -19,9 +19,9 @@ static CERR cerr_word[] = { /** * wordのエラーをエラーリストに追加 */ -bool addcerrlist_word() +void addcerrlist_word() { - return addcerrlist(ARRAYSIZE(cerr_word), cerr_word); + addcerrlist(ARRAYSIZE(cerr_word), cerr_word); } /** @@ -108,7 +108,7 @@ char *word2n(WORD word) *(digit + j) = *(p + (i - 1) - j); } *(digit + j + 1) = '\0'; - free_chk(p, "word2n.p"); + FREE(p); return digit; } diff --git a/test/unit/addcerrlist/0.txt b/test/unit/addcerrlist/0.txt index 96fdd38..b2c53d7 100644 --- a/test/unit/addcerrlist/0.txt +++ b/test/unit/addcerrlist/0.txt @@ -1,4 +1,16 @@ -126: source file is not specified +202: SVC input - out of Input memory +203: SVC output - out of COMET II memory +204: Program Register (PR) - out of COMET II memory +205: Stack Pointer (SP) - cannot allocate stack buffer +206: Address - out of COMET II memory +207: Stack Pointer (SP) - out of COMET II memory +201: Load object file - full of COMET II memory +114: not integer +115: not hex +116: out of hex range +114: not integer +115: not hex +116: out of hex range 101: label already defined 102: label table is full 103: label not found @@ -21,16 +33,4 @@ 123: unclosed quote 124: more than one character in literal 125: not GR in operand x -114: not integer -115: not hex -116: out of hex range -114: not integer -115: not hex -116: out of hex range -201: Load object file - full of COMET II memory -202: SVC input - out of Input memory -203: SVC output - out of COMET II memory -204: Program Register (PR) - out of COMET II memory -205: Stack Pointer (SP) - cannot allocate stack buffer -206: Address - out of COMET II memory -207: Stack Pointer (SP) - out of COMET II memory +126: source file is not specified diff --git a/test/unit/getcmdtype/0.txt b/test/unit/getcmdtype/0.txt index 8d23e5c..b904ae0 100644 --- a/test/unit/getcmdtype/0.txt +++ b/test/unit/getcmdtype/0.txt @@ -1,5 +1,5 @@ -#FFFF ---> 000 -#0001 ---> 000 +#FFFF ---> 077 +#0001 ---> 077 #0000 ---> 000 #1000 ---> 011 #1100 ---> 010 -- 2.18.0