nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #include <assert.h> |
2 | #include <isl/obj.h> |
||
3 | #include <isl/printer.h> |
||
4 | #include <isl/stream.h> |
||
5 | #include <isl/options.h> |
||
6 | |||
7 | struct isl_arg_choice cat_format[] = { |
||
8 | {"isl", ISL_FORMAT_ISL}, |
||
9 | {"omega", ISL_FORMAT_OMEGA}, |
||
10 | {"polylib", ISL_FORMAT_POLYLIB}, |
||
11 | {"ext-polylib", ISL_FORMAT_EXT_POLYLIB}, |
||
12 | {"latex", ISL_FORMAT_LATEX}, |
||
13 | {0} |
||
14 | }; |
||
15 | |||
16 | struct cat_options { |
||
17 | struct isl_options *isl; |
||
18 | unsigned format; |
||
19 | }; |
||
20 | |||
21 | ISL_ARGS_START(struct cat_options, cat_options_args) |
||
22 | ISL_ARG_CHILD(struct cat_options, isl, "isl", &isl_options_args, "isl options") |
||
23 | ISL_ARG_CHOICE(struct cat_options, format, 0, "format", \ |
||
24 | cat_format, ISL_FORMAT_ISL, "output format") |
||
25 | ISL_ARGS_END |
||
26 | |||
27 | ISL_ARG_DEF(cat_options, struct cat_options, cat_options_args) |
||
28 | |||
29 | int main(int argc, char **argv) |
||
30 | { |
||
31 | struct isl_ctx *ctx; |
||
32 | struct isl_stream *s; |
||
33 | struct isl_obj obj; |
||
34 | struct cat_options *options; |
||
35 | isl_printer *p; |
||
36 | |||
37 | options = cat_options_new_with_defaults(); |
||
38 | assert(options); |
||
39 | argc = cat_options_parse(options, argc, argv, ISL_ARG_ALL); |
||
40 | |||
41 | ctx = isl_ctx_alloc_with_options(&cat_options_args, options); |
||
42 | |||
43 | s = isl_stream_new_file(ctx, stdin); |
||
44 | obj = isl_stream_read_obj(s); |
||
45 | isl_stream_free(s); |
||
46 | |||
47 | p = isl_printer_to_file(ctx, stdout); |
||
48 | p = isl_printer_set_output_format(p, options->format); |
||
49 | p = obj.type->print(p, obj.v); |
||
50 | p = isl_printer_end_line(p); |
||
51 | isl_printer_free(p); |
||
52 | |||
53 | obj.type->free(obj.v); |
||
54 | |||
55 | isl_ctx_free(ctx); |
||
56 | |||
57 | return 0; |
||
58 | } |