From 6e166174d6c10a927c7c6edaadb410e6dd74e068 Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" Date: Fri, 25 Jan 2013 19:06:28 +0100 Subject: [PATCH] add H_FIELD variants for built-in types --- examples/glue.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/glue.h b/examples/glue.h index 4f69f51..568cbda 100644 --- a/examples/glue.h +++ b/examples/glue.h @@ -91,8 +91,12 @@ void * h_seq_index_user (HTokenType type, const HParsedToken *p, size_t #define H_INDEX(TYP, SEQ, IDX) \ ((TYP *) h_seq_index_user(TT_ ## TYP, SEQ, IDX)) -// Standard short-hand to access and cast a user-type field on a sequence token. +// Standard short-hand to access and cast elements on a sequence token. #define H_FIELD(TYP, IDX) H_INDEX(TYP, p->ast, IDX) +#define H_FIELD_SEQ(IDX) h_seq_index_seq(p->ast, IDX) +#define H_FIELD_BYTES(IDX) h_seq_index_bytes(p->ast, IDX) +#define H_FIELD_SINT(IDX) h_seq_index_sint(p->ast, IDX) +#define H_FIELD_UINT(IDX) h_seq_index_uint(p->ast, IDX) // Lower-level helper for h_seq_index. HParsedToken *h_carray_index(const HCountedArray *a, size_t i); // XXX -> internal