Polly 20.0.0git
read_in_string_templ.c
Go to the documentation of this file.
1#include <isl/stream.h>
2
3#define xCAT(A,B) A ## B
4#define CAT(A,B) xCAT(A,B)
5#undef TYPE
6#define TYPE CAT(isl_,BASE)
7#define xFN(TYPE,NAME) TYPE ## _ ## NAME
8#define FN(TYPE,NAME) xFN(TYPE,NAME)
9
10/* Read an object of type TYPE from "s", where the object may
11 * either be specified directly or as a string.
12 *
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".
16 */
18{
19 struct isl_token *tok;
20 int type;
21
24 if (type == ISL_TOKEN_STRING) {
25 char *str;
26 isl_ctx *ctx;
27 TYPE *res;
28
29 ctx = isl_stream_get_ctx(s);
30 str = isl_token_get_str(ctx, tok);
31 res = FN(TYPE,read_from_str)(ctx, str);
32 free(str);
33 isl_token_free(tok);
34 return res;
35 }
37 return FN(isl_stream_read,BASE)(s);
38}
#define __isl_give
Definition: ctx.h:19
#define __isl_keep
Definition: ctx.h:25
#define BASE
Definition: flow_cmp.c:49
enum isl_fold type
Definition: isl_test.c:4017
const char * res
Definition: isl_test.c:775
const char * str
Definition: isl_test.c:2095
#define TYPE
#define FN(TYPE, NAME)
void isl_token_free(struct isl_token *tok)
Definition: isl_stream.c:127
@ ISL_TOKEN_STRING
Definition: stream.h:37
void isl_stream_push_token(__isl_keep isl_stream *s, struct isl_token *tok)
Definition: isl_stream.c:311
isl_ctx * isl_stream_get_ctx(__isl_keep isl_stream *s)
Definition: isl_stream.c:800
struct isl_token * isl_stream_next_token(__isl_keep isl_stream *s)
Definition: isl_stream.c:693
__isl_give char * isl_token_get_str(isl_ctx *ctx, struct isl_token *tok)
Definition: isl_stream.c:115
int isl_token_get_type(struct isl_token *tok)
Definition: isl_stream.c:86