1. Shlomi Fish
  2. fc-solve

Commits

Shlomi Fish  committed e603c3c

Accept the --intermediate-input flag.

So far not doing anything with it, but everything so far appears to work.

  • Participants
  • Parent commits 8ac2256
  • Branches master

Comments (0)

Files changed (1)

File fc-solve/source/dbm_solver.c

View file
     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;
             }
             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;
 #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;
         out_fh = NULL;
     }
 
+    if (intermediate_in_fh)
+    {
+        fclose(intermediate_in_fh);
+        intermediate_in_fh = NULL;
+    }
+
     return 0;
 }