unsigned f = 0;
#define f_range 1u
+ d.a = &tv->p_test->a;
if (tvec_readword(tv, &d, 0, delims, what)) { rc = -1; goto end; }
p = d.buf;
if (parse_unsigned_integer(&u, &p, p)) goto bad;
*u_out = u; rc = 0;
end:
- dstr_destroy(&d);
return (rc);
bad:
double x;
int olderr, rc;
+ d.a = &tv->p_test->a;
+
/* Check for special tokens. */
if (STRCMP(p, ==, "#nan")) {
#ifdef NAN
/* All done. */
*x_out = x; rc = 0;
end:
- dstr_destroy(&d);
return (rc);
}
int ch, err, rc;
set_up_encoding(&ccl, &cdf, code); cdc = 0;
+ d.a = w.a = &tv->p_test->a;
if (tvec_nexttoken(tv)) return (tvec_syntax(tv, fgetc(tv->fp), "string"));
do {
dstr_ensure(&d, n);
fill_pattern(d.buf + d.len, n, pp, sz); d.len += n;
}
- xfree(pp); pp = 0;
+ free(pp); pp = 0;
}
/* Anything else is an error. */
end:
/* Clean up any debris. */
if (cdc) cdc->ops->destroy(cdc);
- if (pp) xfree(pp);
+ if (pp) free(pp);
dstr_destroy(&d); dstr_destroy(&w);
return (rc);
}
dstr d = DSTR_INIT;
int rc;
+ d.a = &tv->p_test->a;
if (tvec_readword(tv, &d, 0, ";", "signed integer"))
{ rc = -1; goto end; }
if (parse_signed(&rv->i, d.buf, rd->arg.p, tv)) { rc = -1; goto end; }
rc = 0;
end:
- dstr_destroy(&d);
return (rc);
}
dstr d = DSTR_INIT;
int rc;
+ d.a = &tv->p_test->a;
if (tvec_readword(tv, &d, 0, ";", "unsigned integer"))
{ rc = -1; goto end; }
if (parse_unsigned(&rv->u, d.buf, rd->arg.p, tv)) { rc = -1; goto end; }
rc = 0;
end:
- dstr_destroy(&d);
return (rc);
}
dstr d = DSTR_INIT;
int rc;
+ d.a = &tv->p_test->a;
if (tvec_readword(tv, &d, 0, ";", "floating-point number"))
{ rc = -1; goto end; }
if (parse_floating(&rv->f, 0, d.buf, rd->arg.p, tv))
{ rc = -1; goto end; }
rc = 0;
end:
- dstr_destroy(&d);
return (rc);
}
double t;
int rc;
+ d.a = &tv->p_test->a;
if (tvec_readword(tv, &d, 0, ";", "duration")) { rc = -1; goto end; }
if (parse_floating(&t, &q, d.buf,
rd->arg.p ? rd->arg.p : &tvflt_nonneg, tv))
rv->f = t; rc = 0;
end:
- dstr_destroy(&d);
return (rc);
}
dstr d = DSTR_INIT; \
int rc; \
\
+ d.a = &tv->p_test->a; \
if (tvec_readword(tv, &d, 0, \
";", "%s tag or " LITSTR_##tag_, ei->name)) \
{ rc = -1; goto end; } \
done: \
rc = 0; \
end: \
- dstr_destroy(&d); \
return (rc); \
}
const struct tvec_ienuminfo tvenum_cmp =
{ "cmp", cmp_assoc, &tvrange_int };
+static const struct tvec_passoc dummy_assoc[] = { TVEC_ENDENUM };
+static const struct tvec_penuminfo dummy_peinfo = { "pointer", dummy_assoc };
+
/* --- @tvec_claimeq_tenum@ --- *
*
* Arguments: @struct tvec_state *tv@ = test-vector state
union tvec_misc arg; \
struct tvec_reg rval, rref; \
\
+ PREFLIGHT_##tag; \
arg.p = ei; \
rval.f = rref.f = TVRF_LIVE; \
rval.v.slot = GET_##tag(e0); rref.v.slot = GET_##tag(e1); \
return (tvec_claimeq(tv, &tvty_##slot##enum, &arg, \
&rval, &rref, file, lno, expr)); \
}
+#define PREFLIGHT_INT do ; while (0)
#define GET_INT(e) (e)
+#define PREFLIGHT_UINT do ; while (0)
#define GET_UINT(e) (e)
+#define PREFLIGHT_FLT do ; while (0)
#define GET_FLT(e) (e)
+#define PREFLIGHT_PTR \
+ if (!ei) ei = &dummy_peinfo
#define GET_PTR(e) (UNCONST(void, (e)))
TVEC_MISCSLOTS(DEFCLAIM)
#undef DEFCLAIM
+#undef PREFLIGHT_INT
#undef GET_INT
+#undef PREFLIGHT_UINT
#undef GET_UINT
+#undef PREFLIGHT_FLT
#undef GET_FLT
+#undef PREFLIGHT_PTR
#undef GET_PTR
/*----- Flag types --------------------------------------------------------*/
dstr d = DSTR_INIT;
int ch, rc;
+ d.a = &tv->p_test->a;
+
for (;;) {
/* Read the next item. */
}
/* Otherwise, try to parse it as a raw integer. */
- if (parse_unsigned(&t, d.buf, fi->range, tv))
- { rc = -1; goto end; }
- v |= t;
+ if (parse_unsigned(&t, d.buf, fi->range, tv)) { rc = -1; goto end; }
+ if (m&t) { tvec_error(tv, "colliding flag setting"); rc = -1; goto end; }
+ v |= t; m |= t;
next:
/* Advance to the next token. If it's a separator then consume it, and
/* Done. */
rv->u = v; rc = 0;
end:
- dstr_destroy(&d);
return (rc);
}
union tvec_misc arg;
struct tvec_reg rval, rref;
+ arg.p = fi;
rval.f = rref.f = TVRF_LIVE; rval.v.u = f0; rref.v.u = f1;
return (tvec_claimeq(tv, &tvty_flags, &arg,
&rval, &rref, file, lno, expr));
unsigned f = 0;
#define f_quote 1u
+ d.a = &tv->p_test->a;
+
/* Advance until we find something. */
if (tvec_nexttoken(tv))
return (tvec_syntax(tv, fgetc(tv->fp), "character"));
/* Done. */
rc = 0;
end:
- dstr_destroy(&d);
return (rc);
#undef f_quote