586ab4d5b3502a2d7ca7a74fc2aa331ad0cec2da
[YACASL2.git] / include / cerr.h
1 #ifndef YACASL2_CERR_H_INCLUDED
2 #define YACASL2_CERR_H_INCLUDED
3
4 #include <stdlib.h>
5 #include <string.h>
6 #include <assert.h>
7
8 #ifndef ARRAYSIZE
9 #define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0]))
10 #endif
11
12 /* エラー番号 */
13 extern int cerrno;
14
15 /* エラーメッセージ */
16 extern char *cerrmsg;
17
18 /* エラーコードリスト */
19 typedef struct {
20     int num;
21     char *msg;
22 } CERRARRAY;
23
24 enum {
25     MSGSIZE = 60,
26 };
27
28 /* エラー番号とエラーメッセージを設定 */
29 void setcerr(int num, const char *val);
30
31 /* エラー番号からメッセージを返す */
32 char *getcerrmsg(int num);
33
34 /* エラーを解放する */
35 void freecerr();
36 #endif