root/include/cerr.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef YACASL2_CERR_H_INCLUDED
   2 #define YACASL2_CERR_H_INCLUDED
   3 
   4 #include <stdbool.h>
   5 #include <stdio.h>
   6 #include <stdlib.h>
   7 #include <string.h>
   8 #include <assert.h>
   9 #include <stdbool.h>
  10 #include "cmem.h"
  11 
  12 /**
  13  * @brief エラーを表すデータ型
  14  */
  15 typedef struct _CERR {
  16     int num;        /**<エラー番号 */
  17     char *msg;      /**<エラーメッセージ */
  18 } CERR;
  19 
  20 /**
  21  * @brief 現在のエラー
  22  */
  23 extern CERR *cerr;
  24 
  25 /**
  26  * @brief エラーリストのデータ型
  27  */
  28 typedef struct _CERRLIST {
  29     struct _CERRLIST *next;     /**<リスト次項目へのポインタ */
  30     CERR *cerr;                 /**<エラーの構造体 */
  31 } CERRLIST;
  32 
  33 /**
  34  * @brief エラーリスト
  35  */
  36 extern CERRLIST *cerrlist;
  37 
  38 enum {
  39     CERRSTRSIZE = 10,    /**<エラーメッセージ中に挿入できる文字列のサイズ */
  40     CERRMSGSIZE = 70,    /**<エラーメッセージのサイズ */
  41 };
  42 
  43 /**
  44  * @brief エラーを初期化する
  45  *
  46  */
  47 void cerr_init();
  48 
  49 /**
  50  * @brief エラーリストを作成・追加する
  51  *
  52  *
  53  * @param cerrc 作成または追加するエラーの数
  54  * @param cerrv 作成または追加するエラーの配列
  55  */
  56 void addcerrlist(int cerrc, CERR cerrv[]);
  57 
  58 /**
  59  * @brief エラーリストを表示する
  60  *
  61  */
  62 void printcerrlist();
  63 
  64 /**
  65  * @brief 現在のエラーを設定する
  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  */
  85 void freecerr();
  86 #endif

/* [<][>][^][v][top][bottom][index][help] */