+static unsigned int try_compiling(struct manifest *m,
+ struct ccan_file *i,
+ char **prev,
+ bool keep,
+ struct ccan_file *mangled[3],
+ bool res[3],
+ char *err[3],
+ char **lines[3])
+{
+ unsigned int num;
+
+ /* Try standalone. */
+ mangled[0] = i;
+ res[0] = compile(i, m, mangled[0], keep, &err[0]);
+ lines[0] = get_ccan_file_lines(i);
+ if (res[0] && streq(err[0], ""))
+ return 1;
+
+ if (prev) {
+ lines[1] = combine(i, get_ccan_file_lines(i), prev);
+
+ mangled[1] = mangle_example(m, i, lines[1], keep);
+ res[1] = compile(i, m, mangled[1], keep, &err[1]);
+ if (res[1] && streq(err[1], "")) {
+ return 2;
+ }
+ num = 2;
+ } else
+ num = 1;
+
+ /* Try standalone. */
+ lines[num] = get_ccan_file_lines(i);
+ mangled[num] = mangle_example(m, i, lines[num], keep);
+ res[num] = compile(i, m, mangled[num], keep, &err[num]);
+
+ return num+1;
+}
+