export isl_*_aff_plain_is_equal
[isl.git] / isl_list_read_yaml_templ.c
blob5b6143df9ee47e80e36dfbdb4b70821b9102d6e5
1 /*
2 * Copyright 2013 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8 */
10 #include <isl/stream.h>
12 #include <isl_list_macro.h>
14 /* Read a sequence of EL objects and return them as a list.
16 static __isl_give LIST(EL) *FN(isl_stream_yaml_read,LIST(EL_BASE))(
17 isl_stream *s)
19 isl_ctx *ctx;
20 LIST(EL) *list;
21 isl_bool more;
23 ctx = isl_stream_get_ctx(s);
25 if (isl_stream_yaml_read_start_sequence(s) < 0)
26 return NULL;
28 list = FN(LIST(EL),alloc)(ctx, 0);
29 while ((more = isl_stream_yaml_next(s)) == isl_bool_true) {
30 EL *el;
32 el = FN(isl_stream_read,EL_BASE)(s);
33 list = FN(LIST(EL),add)(list, el);
36 if (more < 0 || isl_stream_yaml_read_end_sequence(s) < 0)
37 return FN(LIST(EL),free)(list);
39 return list;