細部の修正
[YACASL2.git] / src / cerr.c
index 250ad80..ceea3af 100644 (file)
@@ -1,10 +1,5 @@
-#include "casl2.h"
+#include "cerr.h"
 
-/* エラーコードリスト */
-typedef struct {
-    int num;
-    char *msg;
-} CERRARRAY;
 CERRARRAY cerr[] = {
     { 101, "label already defined" },
     { 102, "label table is full" },
@@ -33,29 +28,15 @@ CERRARRAY cerr[] = {
     { 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" }
+    { 206, "Address - out of COMET II memory" },
+    { 207, "Stack Pointer (SP) - out of COMET II memory" },
 };
 
-/* WORD値を文字列に変換 */
-char *wtoa(WORD word)
-{
-    char *p = malloc(6), *q = malloc(6);
-    int i = 0, j;
-    do{
-        *(p + i++) = word % 10 + '0';
-    } while((word /= 10) > 0);
-    for(j = 0; j < i; j++) {
-        *(q + j) = *(p + (i - 1) - j);
-    }
-    *(q + j + 1) = '\0';
-    return q;
-}
-
 /* エラー番号とエラーメッセージを設定する */
 void setcerr(int num, const char *val)
 {
     cerrno = num;
-    cerrmsg = malloc(256);
+    cerrmsg = malloc(MSGSIZE + 1);
     if(val != NULL) {
         strcpy(cerrmsg, val);
         strcat(cerrmsg, ": ");