~vcs-imports-ii/gnuchess/trunk

« back to all changes in this revision

Viewing changes to src/frontend/cmd.cc

  • Committer: aceballos
  • Date: 2017-06-12 21:52:45 UTC
  • Revision ID: svn-v4:6006247a-2d13-4e52-b961-62b44c6c37c8:trunk:157
Tags: v6.2.5-rc2
merge --reintegrate branches/readline; release 6.2.5-rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
static int hardFlag=0;
60
60
static int postFlag=0;
61
61
 
 
62
 
62
63
static void split_input(void)
63
64
{
64
65
  /* r points to the last non-space character */
246
247
/* Give a possible move for the player to play */
247
248
void cmd_hint(void)
248
249
{
 
250
  /* An answer is received only if book on - TODO change this in adapter */
249
251
  SetDataToEngine( token[0] );
250
252
  /* TODO if no hint, inform on stdout */
251
253
}
327
329
 
328
330
void cmd_manual(void)
329
331
{
 
332
  SET (flags, MANUAL);
 
333
  ExpectAnswerFromEngine( false );
330
334
  SetDataToEngine( "force" );
331
 
  SET (flags, MANUAL);
332
335
}
333
336
 
334
337
void cmd_memory(void)
335
338
{
336
339
  if (token[1][0] == 0) {
 
340
    ExpectAnswerFromEngine( true );
337
341
    SetDataToEngine( "memory" );
338
 
    ExpectAnswerFromEngine( true );
339
342
  } else {
340
343
    unsigned int memory;
341
344
    if ( sscanf( token[1], "%d", &memory ) == 1 ) {
343
346
      sprintf( data, "memory %d\nmemory", memory );
344
347
      SetDataToEngine( data );
345
348
    }
 
349
/* TODO Handle error */
346
350
  }
347
351
}
348
352
 
401
405
{
402
406
  CLEAR (flags, POST);
403
407
  postFlag = 0;
 
408
  ExpectAnswerFromEngine( false );
404
409
  SetDataToEngine( token[0] );
405
410
}
406
411
 
608
613
 
609
614
void cmd_ping(void)
610
615
{
 
616
  /* TODO cf. 5.08 */
611
617
  SetDataToEngine( token[0] );
612
618
  /* If ping is received when we are on move, we are supposed to
613
619
     reply only after moving.  In this version of GNU Chess, we
619
625
 
620
626
void cmd_post(void)
621
627
{
 
628
  /* TODO State makes no sense */
622
629
  SET (flags, POST);
623
630
  postFlag = 1;
624
631
  if ( hardFlag && postFlag )
625
632
    ExpectAnswerFromEngine( true );
626
 
  ExpectAnswerFromEngine( true );
 
633
  if ( flags & XBOARD )
 
634
    ExpectAnswerFromEngine( true );
 
635
  else
 
636
    ExpectAnswerFromEngine( false );
627
637
  SetDataToEngine( token[0] );
628
638
}
629
639
 
681
691
 
682
692
void cmd_result(void)
683
693
{
 
694
  /* TODO Do not send to engine */
684
695
  SetDataToEngine( token[0] );
685
696
  if (ofp != stdout) {
686
697
    fprintf(ofp, "result: %s\n",token[1]);
711
722
  SetDataToEngine(data);
712
723
}
713
724
 
714
 
void cmd_solve(void) { Solve (token[1]); }
 
725
void cmd_solve(void)
 
726
{
 
727
  Solve (token[1]);
 
728
}
715
729
 
716
730
/* Set total time for move to be N seconds is "st N" */
717
731
void cmd_st(void)
732
746
 
733
747
void cmd_time(void)
734
748
{
 
749
  /* TODO send what? */
735
750
  SetDataToEngine( token[0] );
736
751
  TimeLimit[1^board.side] = atoi(token[1]) / 100.0f ;
737
752
}
809
824
/* Play variant, we instruct interface in protover we play normal */
810
825
void cmd_variant(void) {}
811
826
 
 
827
/* TODO Not in 5.08 */
812
828
void cmd_usermove(void)
813
829
{
814
830
  /* TODO: Remove the first SetDataToEngine */
902
918
 *
903
919
 ************************************************************************/
904
920
{
 
921
   /* TODO Remove gettext support */
905
922
   if (tokeneq (token[1], "board"))
906
923
      ShowBoard ();
907
924
   else if (tokeneq (token[1], "rating"))
1110
1127
   "coords",
1111
1128
   gettext_noop(" Displays the chessboard rank and file in both graphic and classical views."),
1112
1129
   "nocoords",
1113
 
   gettext_noop(" Does not display the chessboard rank and file in either mode(graphic and classical"),
 
1130
   gettext_noop(" Does not display the chessboard rank and file in either mode (graphic and classical"),
1114
1131
   NULL,
1115
1132
   NULL
1116
1133
};