a8860c463c3ad462a975319bd5c963c666951d7f
[YACASL2.git] / test / unit / print_code_type_hash / print_code_type.c
1 #include "casl2.h"
2 #include "cerr.h"
3
4 /* 命令コードがキーのハッシュ表を表示する */
5 void print_code_type()
6 {
7     int i;
8     CMDCODETAB *np;
9     for(i = 0; i < cmdtabsize; i++){
10         for(np = code_type[i]; np != NULL; np = np->next) {
11             fprintf(stdout, "(%2d) - #%04X\t0%02o\t%s\n",
12                     i, np->cmdtypecode->code, np->cmdtypecode->type, np->cmdtypecode->cmd);
13         }
14     }
15 }
16
17 int main()
18 {
19     /* エラーの初期化 */
20     cerr = malloc_chk(sizeof(CERR), "cerr");
21     /* ハッシュ表作成 */
22     create_code_type();
23     /* ハッシュ表表示 */
24     print_code_type();
25     /* ハッシュ表解放 */
26     free_code_type();
27     /* エラーの表示 */
28     if(cerr->num != 0) {
29         printf("\terror - %d: %s\n", cerr->num, cerr->msg);
30         freecerr();
31         exit(-1);
32     }
33     return 0;
34 }