From: j8takagi Date: Tue, 26 Jan 2010 00:10:19 +0000 (+0900) Subject: getlabel関数の引数を変更 X-Git-Tag: v0.1~77 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=534506a757688db300328b7141bab4d6d0bd4e29;p=YACASL2.git getlabel関数の引数を変更 「label, prg」=>「prog, label」 --- diff --git a/include/assemble.h b/include/assemble.h index 30a4afb..139cea7 100644 --- a/include/assemble.h +++ b/include/assemble.h @@ -51,7 +51,7 @@ typedef enum { } PASS; /* ラベル表からアドレスを検索する */ -WORD getlabel(const char *label, const char *prog); +WORD getlabel(const char *prog, const char *label); /* ラベルを表に追加する */ bool addlabel(const char *prog, const char *label, WORD word); diff --git a/src/assemble.c b/src/assemble.c index 74a6a75..0bfc551 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -82,7 +82,7 @@ WORD getadr(const char *str, PASS pass) } else if(isdigit(*str) || *str == '-') { adr = getint(str); } else { - if(pass == SECOND && (adr = getlabel(str, prog)) == 0xFFFF) { + if(pass == SECOND && (adr = getlabel(prog, str)) == 0xFFFF) { setcerr(103, str); /* label not found */ } } @@ -164,7 +164,7 @@ void writeDC(const char *str, PASS pass) } else if(isdigit(*str) || *str == '-') { adr = getint(str); } else { - if(pass == SECOND && (adr = getlabel(str, prog)) == 0xFFFF) { + if(pass == SECOND && (adr = getlabel(prog, str)) == 0xFFFF) { setcerr(103, str); /* label not found */ } } @@ -209,7 +209,7 @@ bool assemblecmd(const CMDLINE *cmdl, PASS pass) prog = strdup(cmdl->label); /* オペランドがある場合、実行開始番地を設定 */ if(pass == SECOND && cmdl->opd->opdc == 1) { - if((startptr = getlabel(cmdl->opd->opdv[0], prog)) == 0xFFFF) { + if((startptr = getlabel(prog, cmdl->opd->opdv[0])) == 0xFFFF) { setcerr(103, cmdl->opd->opdv[0]); /* label not found */ } } diff --git a/src/label.c b/src/label.c index 5a0b4cc..035665a 100644 --- a/src/label.c +++ b/src/label.c @@ -4,7 +4,7 @@ LABELTAB *labels[LABELTABSIZE]; /* ラベル表からアドレスを検索する */ -WORD getlabel(const char *label, const char *prog) +WORD getlabel(const char *prog, const char *label) { LABELTAB *np; @@ -22,7 +22,7 @@ bool addlabel(const char *prog, const char *label, WORD adr) LABELTAB *np; unsigned hashval; - if(getlabel(label, prog) != 0xFFFF) { + if(getlabel(prog, label) != 0xFFFF) { setcerr(101, label); /* label already defined */ return false; }