#include <setjmp.h>
struct svp64_ctx {
+ const char *name;
const struct svp64_desc *desc;
};
}
}
-static char *
+#define SVP64_SEP '/'
+
+static void
svp64_decode (char *str, struct svp64_ctx *svp64)
{
+ char *opc;
+ const struct svp64_record *record;
+
str += (sizeof ("sv.") - 1);
- svp64->desc = (const struct svp64_desc *) str_hash_find (svp64_hash, str);
+ if (! ISALPHA (*str))
+ svp64_raise (_("unrecognized opcode: `%s'"), str);
+
+ opc = str;
+ for (; ! ISSPACE (*str) && *str != SVP64_SEP && *str != '\0'; ++str)
+ ;
+ if (*str != '\0')
+ *str++ = '\0';
+
+ svp64->desc = (const struct svp64_desc *) str_hash_find (svp64_hash, opc);
if (!svp64->desc)
svp64_raise (_("unrecognized opcode: `%s'"), str);
- return str;
+ record = (const void *)((unsigned char *)svp64->desc -
+ offsetof (struct svp64_record, desc));
+ svp64->name = record->name;
}
static void