Commits

Shlomi Fish  committed 3f7a87e

Add the r2410 - r2411 patch.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/branches/investigate-p4-slowdown-by-r2911@2949 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

  • Participants
  • Parent commits 0dc56b7
  • Branches investigate-p4-slowdown-by-r2911, investigate-p4-slowdown-by-r2911@3680
  • Tags gcc-4.5-slowdown-After@2949

Comments (0)

Files changed (4)

File fc-solve/source/cmd_line.c

 break;
 
 case 'd':
+
+{
+if (*(p++) == 'e')
+{
+{ switch(*(p++)) {
+case 'c':
 {
-if (!strncmp(p, "ecks-num", 8)) {
-p += 8;
+if (!strncmp(p, "ks-num", 6)) {
+p += 6;
 opt = FCS_OPT_DECKS_NUM;
 
 }
 
 break;
 
+case 'p':
+{
+if (!strncmp(p, "th-tests-order", 14)) {
+p += 14;
+opt = FCS_OPT_DEPTH_TESTS_ORDER;
+
+}
+}
+
+break;
+
+}
+}
+
+}
+
+}
+
+break;
+
 case 'e':
 {
 if (!strncmp(p, "mpty-stacks-filled-by", 21)) {
 
 break;
 
+case 'd':
+{
+if (!strncmp(p, "to", 2)) {
+p += 2;
+opt = FCS_OPT_DEPTH_TESTS_ORDER;
+
+}
+}
+
+break;
+
 case 'g':
 
 {
         }
         break;
 
+        case FCS_OPT_DEPTH_TESTS_ORDER: /* STRINGS=-dto|--depth-tests-order; */
+        {
+            PROCESS_OPT_ARG() ;
+
+            {
+                char * fcs_user_errstr;
+                int min_depth;
+                int ret;
+                const char * s;
+
+                min_depth = 0;
+
+                s = (*arg);
+                while(isdigit(*s))
+                {
+                    s++;
+                }
+                if (*s == ',')
+                {
+                    min_depth = atoi((*arg));
+                    s++;
+                }
+
+                ret = freecell_solver_user_set_depth_tests_order(
+                        instance,
+                        min_depth,
+                        (*arg),
+                        &fcs_user_errstr
+                        );
+                
+                if (ret != 0)
+                {
+                    char * errstr = malloc(strlen(fcs_user_errstr)+500);
+                    sprintf(
+                            errstr,
+                            "Error in depth tests' order!\n%s\n",
+                            fcs_user_errstr
+                           );
+                    free(fcs_user_errstr);
+
+                    *error_string = errstr;
+
+                    RET_ERROR_IN_ARG() ;
+                }
+            }
+        }
+        break;
 
         }
         /* OPT-PARSE-END */

File fc-solve/source/cmd_line_enum.h

     FCS_OPT_SCANS_SYNERGY,
     FCS_OPT_RESET,
     FCS_OPT_READ_FROM_FILE,
-    FCS_OPT_LOAD_CONFIG
+    FCS_OPT_LOAD_CONFIG,
+    FCS_OPT_DEPTH_TESTS_ORDER
 };

File fc-solve/source/fcs_user.h

     void * api_instance
     );
 
+/* 
+ * This sets the tests_order from min_depth onwards.
+ * */
+DLLEXPORT extern int freecell_solver_user_set_depth_tests_order(
+    void * user_instance,
+    int min_depth,
+    const char * tests_order,
+    char * * error_string
+    );
+
 #ifdef __cplusplus
 }
 #endif

File fc-solve/source/lib.c

     return user->error_string;
 }
 
+int DLLEXPORT freecell_solver_user_set_depth_tests_order(
+    void * api_instance,
+    int min_depth,
+    const char * tests_order,
+    char * * error_string
+    )
+{
+    fcs_user_t * user;
+    fcs_instance_item_t * instance_item;
+
+    user = (fcs_user_t *)api_instance;
+
+    instance_item = &(user->instances_list[user->current_instance_idx]);
+    
+    *error_string = NULL;
+
+    if (min_depth < 0)
+    {
+        *error_string = strdup("Depth is negative.");
+        return 1;
+    }
+
+    return 0;
+}
 
 #ifdef FCS_COMPILE_DEBUG_FUNCTIONS