2 * Copyright 2017 Sven Verdoolaege
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege.
12 #include <isl/options.h>
13 #include <isl/schedule.h>
16 struct isl_options
*isl
;
21 ISL_ARGS_START(struct options
, options_args
)
22 ISL_ARG_CHILD(struct options
, isl
, "isl", &isl_options_args
, "isl options")
23 ISL_ARG_ARG(struct options
, schedule1
, "schedule1", NULL
)
24 ISL_ARG_ARG(struct options
, schedule2
, "schedule2", NULL
)
27 ISL_ARG_DEF(options
, struct options
, options_args
)
29 static void die(const char *msg
)
31 fprintf(stderr
, "%s\n", msg
);
35 static FILE *open_or_die(const char *filename
)
39 file
= fopen(filename
, "r");
41 fprintf(stderr
, "Unable to open %s\n", filename
);
47 /* Given two YAML descriptions of isl_schedule objects, check whether
48 * they are equivalent.
49 * Return EXIT_SUCCESS if they are and EXIT_FAILURE if they are not
50 * or if anything else went wrong.
52 int main(int argc
, char **argv
)
55 struct options
*options
;
56 FILE *input1
, *input2
;
58 isl_schedule
*s1
, *s2
;
60 options
= options_new_with_defaults();
64 ctx
= isl_ctx_alloc_with_options(&options_args
, options
);
65 argc
= options_parse(options
, argc
, argv
, ISL_ARG_ALL
);
67 input1
= open_or_die(options
->schedule1
);
68 input2
= open_or_die(options
->schedule2
);
69 s1
= isl_schedule_read_from_file(ctx
, input1
);
70 s2
= isl_schedule_read_from_file(ctx
, input2
);
72 equal
= isl_schedule_plain_is_equal(s1
, s2
);
76 die("schedules differ");
78 isl_schedule_free(s1
);
79 isl_schedule_free(s2
);