From 285d44a446b45fa1a5ac66617b6920bc7ba81fa6 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Sun, 14 Feb 2010 02:18:43 +0900 Subject: [PATCH] =?utf8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E6=99=82=E3=81=AE?= =?utf8?q?=E5=8B=95=E4=BD=9C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/cerr.h | 6 ++++-- src/casl2.c | 10 +++++----- src/cerr.c | 10 ++++------ src/comet2.c | 2 +- src/token.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/cerr.h b/include/cerr.h index 878fd85..828d03e 100644 --- a/include/cerr.h +++ b/include/cerr.h @@ -1,6 +1,7 @@ #ifndef YACASL2_CERR_H_INCLUDED #define YACASL2_CERR_H_INCLUDED +#include #include #include #include @@ -25,11 +26,12 @@ typedef struct { extern CERRARRAY cerr[]; enum { - MSGSIZE = 60, + CERRSTRSIZE = 10, /* エラーメッセージ中に挿入できる文字列のサイズ */ + CERRMSGSIZE = 70, /* エラーメッセージのサイズ */ }; /* エラー番号とエラーメッセージを設定 */ -void setcerr(int num, const char *val); +void setcerr(int num, const char *str); /* エラー番号からメッセージを返す */ char *getcerrmsg(int num); diff --git a/src/casl2.c b/src/casl2.c index 457dde7..c3a5550 100644 --- a/src/casl2.c +++ b/src/casl2.c @@ -30,19 +30,19 @@ CERRARRAY cerr[] = { { 103, "label not found" }, { 104, "label length is too long" }, { 105, "no command in the line" }, - { 106, "operand count mismatch" }, + { 106, "operand mismatch in assemble command" }, { 107, "no label in START" }, { 108, "not command of operand \"r\"" }, { 109, "not command of operand \"r1,r2\"" }, { 110, "not command of operand \"r,adr[,x]\"" }, { 111, "not command of operand \"adr[,x]\"" }, { 112, "not command of no operand" }, - { 113, "command not defined" }, + { 113, "operand too many in machine command" }, { 114, "not integer" }, { 115, "not hex" }, { 116, "out of hex range" }, - { 117, "operand is too many" }, - { 118, "operand length is too long" }, + { 117, "operand too many in DC" }, + { 118, "operand length too long" }, { 119, "out of COMET II memory" }, { 120, "GR0 in operand x" }, { 121, "cannot get operand token" }, @@ -76,7 +76,7 @@ const char *objfile_name(const char *str) { const char *default_name = "a.o"; - if(optarg == NULL) { + if(str == NULL) { return default_name; } else { return str; diff --git a/src/cerr.c b/src/cerr.c index be3e58b..1aeb8c4 100644 --- a/src/cerr.c +++ b/src/cerr.c @@ -5,16 +5,14 @@ int cerrno = 0; char *cerrmsg; /* エラー番号とエラーメッセージを設定する */ -void setcerr(int num, const char *val) +void setcerr(int num, const char *str) { assert(cerr != NULL && num > 0); cerrno = num; - cerrmsg = malloc(MSGSIZE + 1); - if(val != NULL) { - strcpy(cerrmsg, val); - strcat(cerrmsg, ": "); - strcat(cerrmsg, getcerrmsg(cerrno)); + cerrmsg = malloc(CERRMSGSIZE + 1); + if(str != NULL && strlen(str) < 10) { + sprintf(cerrmsg, "%s: %s", str, getcerrmsg(cerrno)); } else { strcpy(cerrmsg, getcerrmsg(cerrno)); } diff --git a/src/comet2.c b/src/comet2.c index ba26cf6..a3fc2a0 100644 --- a/src/comet2.c +++ b/src/comet2.c @@ -17,7 +17,7 @@ static struct option longopts[] = { /* エラー番号とエラーメッセージ */ CERRARRAY cerr[] = { - { 201, "execute - out of COMET II memory" }, + { 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" }, diff --git a/src/token.c b/src/token.c index 3ea2073..ec86ac5 100644 --- a/src/token.c +++ b/src/token.c @@ -17,7 +17,7 @@ OPD *opdtok(const char *str) do { /* オペランド数が多すぎる場合はエラー */ if(opd->opdc >= OPDSIZE) { - setcerr(117, str); /* operand is too many */ + setcerr(117, NULL); /* operand is too many */ break; } /* 先頭が「=」の場合の処理 */ -- 2.18.0