release_bytes
};
+/* Text strings. Not really intended as an output type. */
+
+void allocate_string(union regval *v, size_t sz)
+ { v->str.p = xmalloc(sz + 1); v->str.sz = sz; }
+
+static void init_string(union regval *v) { v->str.p = 0; v->str.sz = 0; }
+
+static void parse_string(union regval *v, char *p)
+{
+ size_t n = strlen(p);
+
+ allocate_string(v, n);
+ memcpy(v->str.p, p, n + 1);
+}
+
+static void dump_string(FILE *fp, const union regval *v)
+{
+ if (v->str.p) fprintf(fp, "`%s'\n", v->str.p);
+ else fputs("nil\n", fp);
+}
+
+static int eq_string(const union regval *v0, const union regval *v1)
+{
+ size_t n0 = v0->str.sz, n1 = v1->str.sz, n = n0 < n1 ? n0 : n1;
+ return !strncmp(v0->str.p, v1->str.p, n);
+}
+
+static void release_string(union regval *v) { free(v->str.p); }
+
+const struct regty regty_string = {
+ init_string,
+ parse_string,
+ dump_string,
+ eq_string,
+ release_string
+};
+
/*----- Core test machinery -----------------------------------------------*/
/* Say that a register is `reset' by releasing and then re-initializing it.
printf("failed test `%s'\n", test->name);
for (def = test->regs; def->name; def++) {
in = REG(in, def->i);
+ if (!(in->f®F_LIVE)) continue;
if (def->i >= state->nrout) {
printf("\t input `%s' = ", def->name);
def->ty->dump(stdout, &in->v);