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