+/**
+ * エラーの初期化
+ */
+void cerr_init()
+{
+ cerr = malloc_chk(sizeof(CERR), "cerr");
+ cerr->num = 0;
+}
+
+/**
+ * 現在のエラー
+ */
+CERR *cerr;
+
+/**
+ * エラーリスト
+ */
+CERRLIST *cerrlist = NULL;
+
+/**
+ * エラーリストを作成または追加する
+ */
+void addcerrlist(int errc, CERR errv[])
+{
+ int i;
+ CERRLIST *p = NULL, *q = malloc_chk(sizeof(CERRLIST), "cerrlist");
+
+ assert(errc > 0 && errv != NULL);
+ for(i = 0; i < errc; i++) {
+ if(p == NULL) {
+ p = q;
+ } else {
+ p = p->next = malloc_chk(sizeof(CERRLIST), "cerrlist.next");
+ }
+ p->cerr = &errv[i];
+ p->next = NULL;
+ }
+ p->next = cerrlist;
+ cerrlist = q;
+}