Permalink
Browse files

Accept the --intermediate-input flag.

So far not doing anything with it, but everything so far appears to work.
  • Loading branch information...
1 parent 8ac2256 commit e603c3c70ea8a1498f9393fe1962da107b8b460a @shlomif committed Apr 6, 2012
Showing with 31 additions and 2 deletions.
  1. +31 −2 fc-solve/source/dbm_solver.c
@@ -740,8 +740,9 @@ int main(int argc, char * argv[])
const char * dbm_store_path;
int num_threads;
int arg;
- const char * filename = NULL, * out_filename = NULL;
- FILE * fh = NULL, * out_fh = NULL;
+ const char * filename = NULL, * out_filename = NULL,
+ * intermediate_input_filename = NULL;
+ FILE * fh = NULL, * out_fh = NULL, * intermediate_in_fh = NULL;
char user_state[USER_STATE_SIZE];
fc_solve_delta_stater_t * delta;
fcs_state_keyval_pair_t init_state;
@@ -839,6 +840,16 @@ int main(int argc, char * argv[])
}
out_filename = argv[arg];
}
+ else if (!strcmp(argv[arg], "--intermediate-input"))
+ {
+ arg++;
+ if (arg == argc)
+ {
+ fprintf(stderr, "--intermediate-input came without an argument.\n");
+ exit(-1);
+ }
+ intermediate_input_filename = argv[arg];
+ }
else
{
break;
@@ -906,6 +917,18 @@ int main(int argc, char * argv[])
#endif
);
+ if (intermediate_input_filename)
+ {
+ intermediate_in_fh = fopen(intermediate_input_filename, "rt");
+ if (! intermediate_in_fh)
+ {
+ fprintf (stderr,
+ "Could not open file '%s' as --intermediate-input-filename.\n",
+ intermediate_input_filename);
+ exit(-1);
+ }
+ }
+
{
fcs_dbm_queue_item_t * first_item;
fcs_encoded_state_buffer_t parent_and_move;
@@ -1101,5 +1124,11 @@ int main(int argc, char * argv[])
out_fh = NULL;
}
+ if (intermediate_in_fh)
+ {
+ fclose(intermediate_in_fh);
+ intermediate_in_fh = NULL;
+ }
+
return 0;
}

0 comments on commit e603c3c

Please sign in to comment.