#ifndef YACASL2_CERR_H_INCLUDED
#define YACASL2_CERR_H_INCLUDED
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
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);
{ 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" },
{
const char *default_name = "a.o";
- if(optarg == NULL) {
+ if(str == NULL) {
return default_name;
} else {
return str;
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));
}
/* エラー番号とエラーメッセージ */
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" },