Restore SIGINT for stopping gnushogi when thinking.
[gnushogi.git] / gnushogi / commondsp.c
index 50dc032..31dc80e 100644 (file)
@@ -4,11 +4,14 @@
  *     Common display routines for GNU Shogi.
  *
  * ----------------------------------------------------------------------
- *
- * Copyright (c) 2012 Free Software Foundation
+ * Copyright (c) 1993, 1994, 1995 Matthias Mutz
+ * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
  *
  * GNU SHOGI is based on GNU CHESS
  *
+ * Copyright (c) 1988, 1989, 1990 John Stanback
+ * Copyright (c) 1992 Free Software Foundation
+ *
  * This file is part of GNU SHOGI.
  *
  * GNU Shogi is free software; you can redistribute it and/or modify it
@@ -125,6 +128,17 @@ movealgbr(short m, char *s)
 
 /*
  * Generate move strings in different formats.
+ *
+ * INPUT:
+ * - f                                 piece to be moved
+ *   - 0 < f < NO_SQUARES                              source square
+ *   - NO_SQUARES <= f NO_SQUARES + 2*NO_PIECES                dropped piece modulo NO_PIECES
+ * - t & 0x7f                          target square
+ * - t & 0x80                          promotion flag
+ * - flag                              FIXME: must be zero ?
+ *
+ * OUTPUT:
+ * - GLOBAL mvstr
  */
 
 void
@@ -386,17 +400,17 @@ parser(char *f, int side, short *fpiece)
 
     if (f[1] == '*' || f[1] == '\'')
     {
-        c2 = '9' - f[2];
-        r2 = 'i' - f[3];
+        c2 = COL_NAME(f[2]);
+        r2 = ROW_NAME(f[3]);
 
         return ((NO_SQUARES + *fpiece) << 8) | locn(r2, c2);
     }
     else
     {
-        c1 = '9' - f[1];
-        r1 = 'i' - f[2];
-        c2 = '9' - f[3];
-        r2 = 'i' - f[4];
+        c1 = COL_NAME(f[1]);
+        r1 = ROW_NAME(f[2]);
+        c2 = COL_NAME(f[3]);
+        r2 = ROW_NAME(f[4]);
         p = (f[5] == '+') ? 0x80 : 0;
 
         return (locn(r1, c1) << 8) | locn(r2, c2) | p;
@@ -716,7 +730,7 @@ SaveGame(void)
 
         for (i = NO_ROWS - 1; i > -1; i--)
         {
-            fprintf(fd, "%c ", 'i' - i);
+            fprintf(fd, "%c ", ROW_NAME(i));
 
             for (c = 0; c < NO_COLS; c++)
             {
@@ -751,7 +765,7 @@ SaveGame(void)
         }
 
         fputs(empty, fd);
-        fprintf(fd, "   9 8 7 6 5 4 3 2 1\n");
+        fprintf(fd, "   9 8 7 6 5 4 3 2 1\n");    /* FIXME */
         fputs(empty, fd);
         fprintf(fd, "   p  l  n  s  g  b  r  k\n");
 
@@ -2148,7 +2162,7 @@ InputCommand(char *command)
 #endif
     }
 
-    signal(SIGUSR1, TerminateSearch);
+    signal(SIGINT, TerminateSearch);
 }