1 #include <isl/stream.h>
3 #define xCAT(A,B) A ## B
4 #define CAT(A,B) xCAT(A,B)
6 #define TYPE CAT(isl_,BASE)
7 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
8 #define FN(TYPE,NAME) xFN(TYPE,NAME)
10 /* Read an object of type TYPE from "s", where the object may
11 * either be specified directly or as a string.
13 * First check if the next token in "s" is a string. If so, try and
14 * extract the object from the string.
15 * Otherwise, try and read the object directly from "s".
17 static __isl_give TYPE
*FN(read
,BASE
)(__isl_keep isl_stream
*s
)
19 struct isl_token
*tok
;
22 tok
= isl_stream_next_token(s
);
23 type
= isl_token_get_type(tok
);
24 if (type
== ISL_TOKEN_STRING
) {
29 ctx
= isl_stream_get_ctx(s
);
30 str
= isl_token_get_str(ctx
, tok
);
31 res
= FN(TYPE
,read_from_str
)(ctx
, str
);
36 isl_stream_push_token(s
, tok
);
37 return FN(isl_stream_read
,BASE
)(s
);