comet2monitorの追加と、モニター機能作成
[YACASL2.git] / src / struct.c
index 0f0ae43..12caf87 100644 (file)
@@ -210,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) {
@@ -238,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;
+}
+
 /**
  * コードがキーの命令ハッシュ表を解放する
  */