xref: /netbsd-src/external/mit/isl/dist/isl_read_from_str_templ.c (revision 5971e316fdea024efff6be8f03536623db06833e)
1 /*
2  * Copyright 2008      Katholieke Universiteit Leuven
3  *
4  * Use of this software is governed by the MIT license
5  *
6  * Written by Sven Verdoolaege, K.U.Leuven, Departement
7  * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8  */
9 
10 #define xCAT(A,B) A ## B
11 #define CAT(A,B) xCAT(A,B)
12 #undef TYPE
13 #define TYPE CAT(isl_,TYPE_BASE)
14 
15 /* Read an object of type TYPE from "str" (using an isl_stream).
16  */
FN(isl,FN (TYPE_BASE,read_from_str))17 __isl_give TYPE *FN(isl,FN(TYPE_BASE,read_from_str))(isl_ctx *ctx,
18 	const char *str)
19 {
20 	TYPE *obj;
21 	isl_stream *s = isl_stream_new_str(ctx, str);
22 	if (!s)
23 		return NULL;
24 	obj = FN(isl_stream_read,TYPE_BASE)(s);
25 	isl_stream_free(s);
26 	return obj;
27 }
28