2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/get_iter_flag.c $
5 $LastChangedRevision: 137 $
6 $Date: 2014-07-15 16:38:33 -0400 (Tue, 15 Jul 2014) $
8 ***********************************************************
10 Previously part of SuperSNARK
14 #include "experimenter.h"
16 #include "get_iter_flag.h"
18 /* --------------------------- get_iter_flag.c ---------------------------
20 This function reads the list of iteration numbers stored in the
21 file containing the comparisons to be made and generates an iteration_flag_line
22 which is needed for the EVALUATE command.
25 anaflname - name of file containing comparisons to be made.
26 iter_flag - string containing a 1 followed by 50 0's.
29 iter_flag - iteration_flag_line needed for the EVALUATE command
30 ------------------------------------------------------------------ */
32 void getiterflag(char* anaflname, char* iter_flag)
34 int iter1, iter2, bit1, bit2, i;
35 char string[MAXLINESIZE];
40 if ((anafl = fopen(anaflname, "r")) == NULL)
42 errorc("in get_iter_flag.c: error in opening file", anaflname);
45 /* the iter_flag is the union of all the iteration numbers */
47 while (fgets(string, sizeof(string), anafl) != NULL)
49 // upgrade flag to 3 if klds is specified
52 if (strcasestr(string, "klds")) flag='3';
53 if (strcasestr(string, "wsqd")) flag='3';
56 if (sscanf(string, "%d %d", &iter1, &iter2) == 2)
58 /* if an iteration number is a multiple of 50
62 if (bit1 == 0 && iter1 != 0)
68 iter_flag[bit1] = flag;
71 if (bit2 == 0 && iter2 != 0)
77 iter_flag[bit2] = flag;