ドキュメントの修正
[YACASL2.git] / include / cerr.h
1 #ifndef YACASL2_CERR_H_INCLUDED
2 #define YACASL2_CERR_H_INCLUDED
3
4 #include <stdbool.h>
5 #include "cmem.h"
6
7 /**
8  * @brief エラーを表すデータ型
9  */
10 typedef struct _CERR {
11     int num;        /**<エラー番号 */
12     char *msg;      /**<エラーメッセージ */
13 } CERR;
14
15 /**
16  * @brief 現在のエラー
17  */
18 extern CERR *cerr;
19
20 /**
21  * @brief エラーリストのデータ型
22  */
23 typedef struct _CERRLIST {
24     struct _CERRLIST *next;     /**<リスト次項目へのポインタ */
25     CERR *cerr;                 /**<エラーの構造体 */
26 } CERRLIST;
27
28 /**
29  * @brief エラーリスト
30  */
31 extern CERRLIST *cerrlist;
32
33 enum {
34     CERRSTRSIZE = 10,    /**<エラーメッセージ中に挿入できる文字列のサイズ */
35     CERRMSGSIZE = 70,    /**<エラーメッセージのサイズ */
36 };
37
38 /**
39  * @brief エラーを初期化する
40  *
41  * @return なし
42  */
43 void cerr_init();
44
45 /**
46  * @brief エラーリストを作成・追加する
47  *
48  * @return なし
49  *
50  * @param cerrc 作成または追加するエラーの数
51  * @param cerrv 作成または追加するエラーの配列
52  */
53 void addcerrlist(int cerrc, CERR cerrv[]);
54
55 /**
56  * @brief エラーリストを表示する
57  *
58  * @return なし
59  */
60 void printcerrlist();
61
62 /**
63  * @brief 現在のエラーを設定する
64  *
65  * @return なし
66  *
67  * @param num エラー番号
68  * @param *str エラーメッセージに含まれる文字列
69  */
70 void setcerr(int num, const char *str);
71
72 /**
73  * @brief エラー番号に対応するエラーメッセージを返す
74  *
75  * @return エラーメッセージ
76  *
77  * @param num エラー番号
78  */
79 char *getcerrmsg(int num);
80
81 /**
82  * @brief エラーリストと現在のエラーを解放する
83  *
84  * @return なし
85  */
86 void freecerr();
87 #endif