From 04a3118439bbcea335da98764406256d10be78f5 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Thu, 11 Feb 2010 07:37:04 +0900 Subject: [PATCH] =?utf8?q?=E3=82=A2=E3=82=BB=E3=83=B3=E3=83=96=E3=83=AB?= =?utf8?q?=E6=99=82=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E8=A1=A8=E7=A4=BA?= =?utf8?q?=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6=E3=80=81=E6=96=B9=E6=B3=95?= =?utf8?q?=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=97=E3=80=81=E3=82=B3=E3=83=BC?= =?utf8?q?=E3=83=89=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/assemble.c | 9 +++++++-- test/integration/casl2/cmd_err0/0.txt | 3 +-- test/integration/casl2/cmd_err1/0.txt | 3 +-- test/integration/casl2/ds_err/0.txt | 3 +-- test/integration/casl2/labeldup_err/0.txt | 3 +-- test/integration/casl2/literalstr_err/0.txt | 3 +-- test/integration/casl2/opdspc_err/0.txt | 3 +-- test/integration/casl2/quoteend_err/0.txt | 3 +-- 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/assemble.c b/src/assemble.c index 36edd2b..b9fbed7 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -395,6 +395,10 @@ bool assembleline(const CMDLINE *cmdl, PASS pass) return status; } +void printline(FILE *stream, const char *filename, int lineno, char *line) { + fprintf(stream, "%s:%5d:%s", filename, lineno, line); +} + /* 指定された名前のファイルをアセンブル */ /* 2回実行される */ bool assemble(const char *file, PASS pass) @@ -422,7 +426,7 @@ bool assemble(const char *file, PASS pass) if((pass == FIRST && (&asmode)->src == true) || (pass == SECOND && (&asmode)->asdetail == true)) { - fprintf(stdout, "%s:%5d:%s", file, lineno, line); + printline(stdout, file, lineno, line); } if((cmdl = linetok(line)) != NULL) { if(pass == FIRST && cmdl->label != NULL) { @@ -439,7 +443,8 @@ bool assemble(const char *file, PASS pass) } } if(cerrno > 0) { - fprintf(stderr, "Assemble error - %d: %s\n %s:%d: %s\n", cerrno, cerrmsg, file, lineno, line); + fprintf(stderr, "Assemble error - %d: %s\n", cerrno, cerrmsg); + printline(stderr, file, lineno, line); status = false; } fclose(fp); diff --git a/test/integration/casl2/cmd_err0/0.txt b/test/integration/casl2/cmd_err0/0.txt index 711c1da..fd2ff24 100644 --- a/test/integration/casl2/cmd_err0/0.txt +++ b/test/integration/casl2/cmd_err0/0.txt @@ -6,5 +6,4 @@ Assemble ../../../../as/ERR/cmd_err0.casl (0) ../../../../as/ERR/cmd_err0.casl: 3: LAD GR2,2 ../../../../as/ERR/cmd_err0.casl: 4: LEA GR1,GR2 Assemble error - 109: LEA: not command of operand "r1,r2" - ../../../../as/ERR/cmd_err0.casl:4: LEA GR1,GR2 - +../../../../as/ERR/cmd_err0.casl: 4: LEA GR1,GR2 diff --git a/test/integration/casl2/cmd_err1/0.txt b/test/integration/casl2/cmd_err1/0.txt index 0c5569a..56921a4 100644 --- a/test/integration/casl2/cmd_err1/0.txt +++ b/test/integration/casl2/cmd_err1/0.txt @@ -4,5 +4,4 @@ Assemble ../../../../as/ERR/cmd_err1.casl (0) ../../../../as/ERR/cmd_err1.casl: 1:MAIN START BEGIN ../../../../as/ERR/cmd_err1.casl: 2:BEGIN LEA GR1,A Assemble error - 110: LEA: not command of operand "r,adr[,x]" - ../../../../as/ERR/cmd_err1.casl:2: BEGIN LEA GR1,A - +../../../../as/ERR/cmd_err1.casl: 2:BEGIN LEA GR1,A diff --git a/test/integration/casl2/ds_err/0.txt b/test/integration/casl2/ds_err/0.txt index 908ba09..211dc12 100644 --- a/test/integration/casl2/ds_err/0.txt +++ b/test/integration/casl2/ds_err/0.txt @@ -6,5 +6,4 @@ Assemble ../../../../as/ERR/ds_err.casl (0) ../../../../as/ERR/ds_err.casl: 3: ST GR0,A ../../../../as/ERR/ds_err.casl: 4:A DS Assemble error - 106: operand count mismatch - ../../../../as/ERR/ds_err.casl:4: A DS - +../../../../as/ERR/ds_err.casl: 4:A DS diff --git a/test/integration/casl2/labeldup_err/0.txt b/test/integration/casl2/labeldup_err/0.txt index ea2931f..9725887 100644 --- a/test/integration/casl2/labeldup_err/0.txt +++ b/test/integration/casl2/labeldup_err/0.txt @@ -8,5 +8,4 @@ Assemble ../../../../as/ERR/labeldup_err.casl (0) ../../../../as/ERR/labeldup_err.casl: 5:A DC 3 ../../../../as/ERR/labeldup_err.casl: 6:A DC 1 Assemble error - 101: A: label already defined - ../../../../as/ERR/labeldup_err.casl:6: A DC 1 - +../../../../as/ERR/labeldup_err.casl: 6:A DC 1 diff --git a/test/integration/casl2/literalstr_err/0.txt b/test/integration/casl2/literalstr_err/0.txt index 755d174..d84ce53 100644 --- a/test/integration/casl2/literalstr_err/0.txt +++ b/test/integration/casl2/literalstr_err/0.txt @@ -2,5 +2,4 @@ Assemble ../../../../as/ERR/literalstr_err.casl (0) Assemble error - 124: 'abcdeABCDE': more than one character in literal - ../../../../as/ERR/literalstr_err.casl:2: LAD GR1,='abcdeABCDE' - +../../../../as/ERR/literalstr_err.casl: 2: LAD GR1,='abcdeABCDE' diff --git a/test/integration/casl2/opdspc_err/0.txt b/test/integration/casl2/opdspc_err/0.txt index e1a99b5..fca7140 100644 --- a/test/integration/casl2/opdspc_err/0.txt +++ b/test/integration/casl2/opdspc_err/0.txt @@ -4,5 +4,4 @@ Assemble ../../../../as/ERR/opdspc_err.casl (0) ../../../../as/ERR/opdspc_err.casl: 1:MAIN START BEGIN ../../../../as/ERR/opdspc_err.casl: 2:BEGIN LD GR1, A Assemble error - 121: cannot get operand token - ../../../../as/ERR/opdspc_err.casl:2: BEGIN LD GR1, A - +../../../../as/ERR/opdspc_err.casl: 2:BEGIN LD GR1, A diff --git a/test/integration/casl2/quoteend_err/0.txt b/test/integration/casl2/quoteend_err/0.txt index 8c19446..53e03fe 100644 --- a/test/integration/casl2/quoteend_err/0.txt +++ b/test/integration/casl2/quoteend_err/0.txt @@ -2,5 +2,4 @@ Assemble ../../../../as/ERR/quoteend_err.casl (0) Assemble error - 123: 'Hello, World!: unclosed quote - ../../../../as/ERR/quoteend_err.casl:4: BUF DC 'Hello, World! - +../../../../as/ERR/quoteend_err.casl: 4:BUF DC 'Hello, World! -- 2.18.0