Merge branch 'master' of linux
[YACASL2.git] / include / cerr.h
1 #ifndef YACASL2_CERR_H_INCLUDED
2 #define YACASL2_CERR_H_INCLUDED
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <assert.h>
8 #include <stdbool.h>
9
10 #include "cmem.h"
11
12 /* エラーの構造体 */
13 typedef struct {
14     int num;        /* エラー番号 */
15     char *msg;      /* エラーメッセージ */
16 } CERR;
17
18 /* 現在のエラー */
19 extern CERR *cerr;
20
21 /* エラーリスト */
22 typedef struct _CERRLIST {
23     struct _CERRLIST *next;
24     CERR *cerr;
25 } CERRLIST;
26
27 extern CERRLIST *cerrlist;
28
29 enum {
30     CERRSTRSIZE = 10,    /* エラーメッセージ中に挿入できる文字列のサイズ */
31     CERRMSGSIZE = 70,    /* エラーメッセージのサイズ */
32 };
33
34 /* エラーの初期化 */
35 void cerr_init();
36
37 /* エラーリストを作成・追加する */
38 bool addcerrlist(int cerrc, CERR cerrv[]);
39
40 /* エラー番号とエラーメッセージを設定 */
41 void setcerr(int num, const char *str);
42
43 /* エラー番号からメッセージを返す */
44 char *getcerrmsg(int num);
45
46 /* エラーを解放する */
47 void freecerr();
48 #endif