w2v-server: add hidden button to show maps for collocators

TODO:
* put 2D-map functions into objects
* parametrize dom destinations
diff --git a/w2v-server.pl b/w2v-server.pl
index 2768296..22dbb3a 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -11,6 +11,7 @@
 use Getopt::Std;
 use Mojo::Server::Daemon;
 use Cwd;
+
 app->static->paths->[0] = getcwd;
 
 plugin 'Log::Access';
@@ -82,6 +83,12 @@
 	$c->reply->static($url);
 };
 
+post '/derekovecs/getVecsByRanks' => sub {
+  my $self = shift;
+  my $vec = getVecs($self->req->json);
+  $self->render(json => $vec);
+};
+
 get '*/img/*' => sub {
 	my $c = shift;
 	my $url = $c->req->url;
@@ -524,6 +531,23 @@
 }
 
 
+AV *getVecs(AV *array) {
+  int i, b;
+  AV *result = newAV();
+  for (i=0; i<=av_len(array); i++) {
+    SV** elem = av_fetch(array, i, 0);
+    if (elem != NULL) {
+      long j = (long) SvNV(*elem);
+      AV *vector = newAV();
+      for (b = 0; b < size; b++) {
+        av_push(vector, newSVnv(M[b + j * size]));
+      }
+      av_push(result, newRV_noinc(vector));
+    }
+  }
+  return result;
+}
+
 wordlist *getTargetWords(char *st1, int search_backw) {
   wordlist *wl = malloc(sizeof(wordlist));
   char st[100][max_size], sep[100];