X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Fstruct.c;h=12caf87e7d31166839548fe25f5f031599e9b6ee;hp=f0f705b8bbf601ff91591391b4cea8deb4d5cc1e;hb=2f0b91ab1a54973a084e1609b46a1432c8b8e334;hpb=4d98d132e119aa98dd7abcb76b6a96ae4723f274 diff --git a/src/struct.c b/src/struct.c index f0f705b..12caf87 100644 --- a/src/struct.c +++ b/src/struct.c @@ -1,9 +1,4 @@ -#include -#include -#include -#include "hash.h" #include "struct.h" -#include "cmem.h" #include "exec.h" /** @@ -215,7 +210,7 @@ const void (*getcmdptr(WORD code)) CMDTYPE getcmdtype(WORD code) { CMDTAB *t; - CMDTYPE type = 0; + CMDTYPE type = NONE; for(t = code_cmdtype[hash_code(code)]; t != NULL; t = t->next) { if(code == t->cmd->code) { @@ -243,6 +238,18 @@ char *getcmdname(WORD code) return cmd; } +/** + * 汎用レジスタの番号からレジスタを表す文字列を返す + */ + +char *grstr(WORD word) +{ + assert(word <= 7); + char *str = malloc_chk(3 + 1, "grstr.str"); + sprintf(str, "GR%d", word); + return str; +} + /** * コードがキーの命令ハッシュ表を解放する */