X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=include%2Fcerr.h;h=662cff26fc9a7731546b5e0e68c68d4e8d488856;hp=878fd859ddff64eab2e0413e396af008bd2b9d2b;hb=555c5e8b851becc08ba661a9cb19f617d5a00c12;hpb=2f889a87ef4e11467f71ea3c03676a8d88cccd7b diff --git a/include/cerr.h b/include/cerr.h index 878fd85..662cff2 100644 --- a/include/cerr.h +++ b/include/cerr.h @@ -1,35 +1,47 @@ #ifndef YACASL2_CERR_H_INCLUDED #define YACASL2_CERR_H_INCLUDED +#include #include #include #include +#include +#include "cmem.h" #ifndef ARRAYSIZE #define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0])) #endif -/* エラー番号 */ -extern int cerrno; +/* エラーの構造体 */ +typedef struct { + int num; /* エラー番号 */ + char *msg; /* エラーメッセージ */ +} CERR; -/* エラーメッセージ */ -extern char *cerrmsg; +/* 現在のエラー */ +extern CERR *cerr; -/* エラーコードリスト */ -typedef struct { - int num; - char *msg; -} CERRARRAY; +/* エラーリスト */ +typedef struct _CERRLIST { + struct _CERRLIST *next; + CERR *cerr; +} CERRLIST; -/* エラーメッセージ */ -extern CERRARRAY cerr[]; +extern CERRLIST *cerrlist; enum { - MSGSIZE = 60, + CERRSTRSIZE = 10, /* エラーメッセージ中に挿入できる文字列のサイズ */ + CERRMSGSIZE = 70, /* エラーメッセージのサイズ */ }; +/* エラーの初期化 */ +void cerr_init(); + +/* エラーリストを作成・追加する */ +bool addcerrlist(int cerrc, CERR cerrv[]); + /* エラー番号とエラーメッセージを設定 */ -void setcerr(int num, const char *val); +void setcerr(int num, const char *str); /* エラー番号からメッセージを返す */ char *getcerrmsg(int num);