w2v-server: fix gcc warnings
diff --git a/w2v-server.pl b/w2v-server.pl
index 6c6d6d8..0487d71 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -421,7 +421,8 @@
   return;
 }
 
-void *getCollocators(knnpars *pars) {
+void *getCollocators(void *args) {
+  knnpars *pars = args;
 	int N = pars->N;
   int cc = pars->wl->wordi[0];
 	knn *nbs = NULL;
@@ -556,7 +557,8 @@
   return(wl);
 }
  
-void *_get_neighbours(knnpars *pars) {
+void *_get_neighbours(void *arg) {
+  knnpars *pars = arg;
 	char *st1 = pars->token;
 	int N = pars->N;
 	long from = pars -> from;
@@ -695,7 +697,7 @@
   }
   printf("Waiting for para threads to join\n");
   fflush(stdout);
-  for (a = 0; a < para_threads; a++) pthread_join(pt[a], &para_nbs[a]);
+  for (a = 0; a < para_threads; a++) pthread_join(pt[a], (void *) &para_nbs[a]);
   printf("Para threads joint\n");
   fflush(stdout);
 
@@ -783,7 +785,7 @@
   if (M2) {
     printf("Waiting for syn threads to join\n");
     fflush(stdout);
-    for (a = 0; a < syn_threads; a++) pthread_join(pt[a+para_threads], &syn_nbs[a]);
+    for (a = 0; a < syn_threads; a++) pthread_join(pt[a+para_threads], (void *) &syn_nbs[a]);
  for (a = 0; a <= syn_threads; a++)			printf("window pos: %d, sum: %f\n", a, window_sums[a]);
     printf("syn threads joint\n");
     fflush(stdout);
@@ -796,18 +798,18 @@
 		
 		float best_window_sum[MAX_NEIGHBOURS];
     int found_index=0, i=0, j, w;
-    if(sort_by != 1 && sort_by != 2) { // sort by auto focus mean
-      for(a=0; a < syn_threads; a++) {
-        for(b=0; b < syn_nbs[a]->length; b++) {
-					for(i=0; i < found_index; i++)
-						if(best[i].wordi == syn_nbs[a]->best[b].wordi)
-							break;
-					if(i >= found_index) {
-						best[found_index++].wordi = syn_nbs[a]->best[b].wordi;
-//						printf("found: %s\n", &vocab[syn_nbs[a]->index[b] * max_w]);
-					}
+    for(a=0; a < syn_threads; a++) {
+      for(b=0; b < syn_nbs[a]->length; b++) {
+				for(i=0; i < found_index; i++)
+					if(best[i].wordi == syn_nbs[a]->best[b].wordi)
+						break;
+				if(i >= found_index) {
+					best[found_index++].wordi = syn_nbs[a]->best[b].wordi;
+					//						printf("found: %s\n", &vocab[syn_nbs[a]->index[b] * max_w]);
 				}
 			}
+		}
+    if(sort_by != 1 && sort_by != 2) { // sort by auto focus mean
 			printf("window: %d  -  syn_threads: %d, %d\n", window, syn_threads, (1 << syn_threads) -1);
 			int wpos;
 			for(i=0; i < found_index; i++) {
@@ -855,7 +857,25 @@
 //				printf("found: %s - sum: %f - window: %d\n", &vocab[best[i].wordi * max_w], best[i].activation, best[i].position);
 //			}
 
-    } else if(sort_by ==1) { // single window position
+    } else if(sort_by == 1) { // responsiveness any window position
+			int wpos;
+			for(i=0; i < found_index; i++) {
+ 					float word_window_sum = 0, word_activation_sum = 0, total_window_sum = 0;
+					for(a=0; a < syn_threads; a++) {
+							wpos = (a >= window? a+1 : a);
+						  for(b=0; b < syn_nbs[a]->length; b++)
+							  if(best[i].wordi == syn_nbs[a]->best[b].wordi) {
+                  best[i].probability += syn_nbs[a]->best[b].probability;
+									if(syn_nbs[a]->best[b].activation > 0.25)
+									  best[i].position |= 1 << wpos;
+									if(syn_nbs[a]->best[b].activation > best[i].activation) {
+										best[i].activation = syn_nbs[a]->best[b].activation;
+                  }
+								}
+					}
+			}
+			qsort(best, found_index, sizeof(collocator), cmp_activation);
+     } else if(sort_by == 2) { // single window position
        for(a=1; a < syn_threads; a++) {
         for(b=0; b < syn_nbs[a]->length; b++) {
           for(c=0; c < MAX_NEIGHBOURS; c++) {
@@ -916,7 +936,7 @@
     hv_store(result, "syntagmatic", strlen("syntagmatic"), newRV_noinc((SV*)array), 0);
   }
 end:
-	words = old_words;
+  words = old_words;
 	free(best);
 	return newRV_noinc((SV*)result);
 }