chiark / gitweb /
WIP routesearch; better debugging output
authorIan Jackson <ian@liberator.(none)>
Sat, 3 Oct 2009 19:32:03 +0000 (20:32 +0100)
committerIan Jackson <ian@liberator.(none)>
Sat, 3 Oct 2009 19:32:03 +0000 (20:32 +0100)
yarrg/rscommon.h
yarrg/rsmain.c
yarrg/rssearch.c

index 1e710dc0075082cfc821d997f5f86c01bc85144f..d81551443a3269402f5d3208680c22b32be5a9ef 100644 (file)
@@ -7,6 +7,7 @@
    DF(sql)                                     \
    DF(sql2)                                    \
    DF(value)                                   \
+   DF(search)                                  \
    DF(lp)
 
 #define debug stdout
index 4b7dea9907678a6840d778d92891f919e8f2d24c..7e5e5e8a2af2b06c5e1199ae075c31eb3f0e658c 100644 (file)
@@ -11,6 +11,7 @@ int main(int argc, const char **argv) {
   const char *arg;
 
   debug_flags= ~( dbg_sql2 );
+  sysassert( !setvbuf(debug,0,_IOLBF,0) );
 
   setup_sql();
   setup_value();
index eb5e9583a3ef92c4c8e02a0fc30b2bd739d625b9..f14b0cd7a87670e6785d6a34bcc2d0adca4e3a22 100644 (file)
@@ -2,6 +2,8 @@
 
 #include "rscommon.h"
 
+DEBUG_DEFINE_DEBUGF(search);
+
 typedef struct Neighbour {
   struct Neighbour *next;
   int islandid;
@@ -35,6 +37,13 @@ static Neighbour *get_neighbours(int isle) {
 static double best_absolute, best_perleague;
 
 static void process_route(int nports, int totaldist) {
+  int i;
+
+  debugf("========== ROUTE");
+  for (i=0; i<nports; i++)
+    debugf(" %d",ports[i]);
+  debugf("\n");
+
   double absolute= value_route(nports, ports);
   double perleague= absolute / (totaldist + nports);
 
@@ -50,7 +59,6 @@ static void process_route(int nports, int totaldist) {
 
   fputs(" route",stderr);
 
-  int i;
   for (i=0; i<nports; i++)
     fprintf(stderr," %d",ports[i]);
   putc('\n',stderr);