X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=include%2Fcerr.h;h=a4d12462f8560e8261c1936799d8543d3780400d;hp=9c191c11b1d74f25f1200a58987cf90a994311fc;hb=755c5127855b776d1a4260f05afc95640045f29d;hpb=e07b6371cc8a59c6793a895e968ff2c6cf28181b diff --git a/include/cerr.h b/include/cerr.h index 9c191c1..a4d1246 100644 --- a/include/cerr.h +++ b/include/cerr.h @@ -1,9 +1,11 @@ #ifndef YACASL2_CERR_H_INCLUDED #define YACASL2_CERR_H_INCLUDED -#include +#include +#include #include #include +#include #ifndef ARRAYSIZE #define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0])) @@ -15,14 +17,31 @@ extern int cerrno; /* エラーメッセージ */ extern char *cerrmsg; -/* エラーコードリスト */ +/* エラーコード配列 */ typedef struct { int num; char *msg; } CERRARRAY; +/* エラーコードリスト */ +typedef struct _CERRLIST { + struct _CERRLIST *next; + CERRARRAY *err; +} CERRLIST; + +/* エラーメッセージ */ +extern CERRLIST *cerr; + +enum { + CERRSTRSIZE = 10, /* エラーメッセージ中に挿入できる文字列のサイズ */ + CERRMSGSIZE = 70, /* エラーメッセージのサイズ */ +}; + +/* エラーを追加する */ +bool addcerrlist(int cerrc, CERRARRAY cerrv[]); + /* エラー番号とエラーメッセージを設定 */ -void setcerr(int num, const char *val); +void setcerr(int num, const char *str); /* エラー番号からメッセージを返す */ char *getcerrmsg(int num);