- The 003 (control-C) character is used to indicate an interrupt.
- a program that does not implement the interrupt feature can ignore the character. If the 003 character is encountered in the middle of a (otherwise) valid commandline, the behaviour is indefined.
after reading the latest GTP draft again, I found that a Go program should ignore any control characters not used by GTP anyway, so the interrupting char could be an extension to GTP that should not confuse programs that don't understand it. GnuGo however, does no filtering of control characters so far.
- the aborted command should return an error status like "?[%d] interrupted\n\n"
This would not handle the commands where interruptig is most important correctly, like genmove. genmove should just return the best move found so far in the search.
Like ordinary commands, the existence of the 003 feature can be tested by "valid_command gtp_interrupt". I should also be included in the output from the "list_commands" command.
Sending the gtp_interrupt command literally (as text) is allowed. It should result in the same behaviour as a 003 character.
Sending the control character is different from a command, since no answer is expected. I don't think that a command doing the same is useful, but it makes assigning answers to commands more difficult for the controlling program.
My proposal is to use gtp_interrupt could to query, if the program really handles the interrupt, so that a GUI can disable its "Stop" button for programs that cannot handle it anyway.
- so, ^C is a bad choice. Any suggestions for an alternative interrupt character? ESC, DEL, ^A, ^G ^X ^T come to mind. ^G seems safe to me. Won't interfere with anything.
Right, this problem exists. I was preferring ^C, since my program can handle SIGINT. If you are using GTP manually in the shell, the ^C is intercepted by the shell and the shell sends a SIGINT to the program. I thought it would be nice to have the same behaviour if you are using a raw stream.
- Markus