Polly 19.0.0git
isl_stream_read_with_params_templ.c
Go to the documentation of this file.
1/*
2 * Copyright 2011 Sven Verdoolaege
3 *
4 * Use of this software is governed by the MIT license
5 *
6 * Written by Sven Verdoolaege.
7 */
8
9#define xCAT(A,B) A ## B
10#define CAT(A,B) xCAT(A,B)
11#undef TYPE
12#define TYPE CAT(isl_,TYPE_BASE)
13
14/* Read an object of type "TYPE" from "s".
15 *
16 * In particular, first read the parameters and the opening brace.
17 * Then read the body that is specific to the object type.
18 * Finally, read the closing brace.
19 */
21{
22 struct vars *v;
23 isl_set *dom;
24 TYPE *obj = NULL;
25
26 v = vars_new(s->ctx);
27 if (!v)
28 return NULL;
29
31 if (next_is_tuple(s)) {
32 dom = read_map_tuple(s, dom, isl_dim_param, v, 1, 0);
34 goto error;
35 }
36 if (isl_stream_eat(s, '{'))
37 goto error;
38
39 obj = FN(isl_stream_read_with_params,TYPE_BASE)(s, dom, v);
40
41 if (isl_stream_eat(s, '}'))
42 goto error;
43
44 vars_free(v);
45 isl_set_free(dom);
46 return obj;
47error:
48 vars_free(v);
49 isl_set_free(dom);
50 FN(TYPE,free)(obj);
51 return NULL;
52}
#define FN(TYPE, NAME)
#define __isl_give
Definition: ctx.h:19
#define __isl_keep
Definition: ctx.h:25
#define TYPE_BASE
Definition: isl_id.c:287
static int next_is_tuple(__isl_keep isl_stream *s)
Definition: isl_input.c:969
static void vars_free(struct vars *v)
Definition: isl_input.c:70
static __isl_give isl_map * read_map_tuple(__isl_keep isl_stream *s, __isl_take isl_map *map, enum isl_dim_type type, struct vars *v, int rational, int comma)
Definition: isl_input.c:1705
static struct vars * vars_new(struct isl_ctx *ctx)
Definition: isl_input.c:48
const char * obj
Definition: isl_test.c:3316
struct isl_set isl_set
Definition: map_type.h:26
__isl_export __isl_give isl_set * isl_set_universe(__isl_take isl_space *space)
Definition: isl_map.c:6366
__isl_null isl_set * isl_set_free(__isl_take isl_set *set)
Definition: isl_map.c:3513
__isl_give isl_space * isl_space_params_alloc(isl_ctx *ctx, unsigned nparam)
Definition: isl_space.c:195
@ isl_dim_param
Definition: space_type.h:15
@ ISL_TOKEN_TO
Definition: stream.h:31
int isl_stream_eat(__isl_keep isl_stream *s, int type)
Definition: isl_stream.c:747
Definition: isl_input.c:42
struct variable * v
Definition: isl_input.c:45