summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-06-14 23:41:56 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-06-14 23:41:56 +0000
commit36f7cba0c4eb6535f170c7b8957e414dd3b91499 (patch)
tree006e030a0254726259e80ad700c8088ce307b6b0
parent5badda2b5c155f5afbd238c97d5ca93b075e2ac5 (diff)
various small bug fixes
-rw-r--r--PLAN13
-rw-r--r--chess-crafty.el5
-rw-r--r--chess-display.el1
-rw-r--r--chess-engine.el17
-rw-r--r--chess-gnuchess.el5
-rw-r--r--chess-ics.el27
-rw-r--r--chess-irc.el5
-rw-r--r--chess-network.el3
-rw-r--r--chess-phalanx.el5
-rw-r--r--chess-transport.el2
-rw-r--r--chess-ucb.el5
11 files changed, 53 insertions, 35 deletions
diff --git a/PLAN b/PLAN
index 7007203..2c2b0c8 100644
--- a/PLAN
+++ b/PLAN
@@ -1,19 +1,24 @@
chess-ics
-- finish all elements of regular use as a client
-- takebacks still aren't working 100%
+- takebacks still aren't working 100%; when I submit a takeback
+ request manually, and the other side accepts, my client doesn't know
+ what to do with it
+- some <12> lines aren't being parsed at all; is the filter missing
+ them?
- accept of a match request doesn't seem to be working
-- the "playing" command does not exist in ICS
chess-display
- when I checkmate my opponent, the display says "Black ...#"
- on the first position, "White" has no white background
+chess-images
+- if chess-display-popup is nil, and I resize the board, it merely
+ deletes the frame and never shows it again
+
chess-engine
- if I say "y" to accepting something from my opponent (new game,
takeback, etc), I get left with an hourglass cursor
chess-irc
-- gives a Lisp error when I try to start it
- if I move before my opponent has connected, I get a symbol assertion
about "value"
diff --git a/chess-crafty.el b/chess-crafty.el
index 509f749..a866cb4 100644
--- a/chess-crafty.el
+++ b/chess-crafty.el
@@ -50,7 +50,7 @@
(cond
((eq event 'initialize)
(let ((proc (chess-common-handler game 'initialize "crafty")))
- (when (and (processp proc)
+ (when (and proc (processp proc)
(eq (process-status proc) 'run))
(process-send-string proc (concat "display nogeneral\n"
"display nochanges\n"
@@ -64,7 +64,8 @@
"display novariation\n"
"alarm off\n"
"ansi off\n"))
- (setq chess-engine-opponent-name "Crafty")
+ (setq chess-engine-process proc
+ chess-engine-opponent-name "Crafty")
t)))
((eq event 'setup-pos)
diff --git a/chess-display.el b/chess-display.el
index 2554a67..e55431b 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -705,7 +705,6 @@ Basically, it means we are playing, not editing or reviewing."
(defun chess-display-search-again ()
(interactive)
- (debug)
(chess-display-search nil t))
(defun chess-display-search-key ()
diff --git a/chess-engine.el b/chess-engine.el
index 8756962..be4aa64 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -265,9 +265,11 @@
((eq event 'call-flag)
(let ((remaining
- (chess-game-data game (if (chess-game-data game 'my-color)
- 'white-remaining
- 'black-remaining))))
+ (if (car args)
+ -1
+ (chess-game-data game (if (chess-game-data game 'my-color)
+ 'white-remaining
+ 'black-remaining)))))
(when (< remaining 0)
(chess-message 'opp-call-flag)
(chess-game-run-hooks game 'flag-fell))))
@@ -297,11 +299,10 @@
(intern (concat (symbol-name module) "-regexp-alist"))))
chess-engine-response-handler
(or response-handler 'chess-engine-default-handler))
- (let ((proc (get-buffer-process (current-buffer))))
- (when (processp proc)
+ (let ((proc chess-engine-process))
+ (when (and proc (processp proc))
(unless (memq (process-status proc) '(run open))
(chess-error 'failed-engine-start))
- (setq chess-engine-process proc)
(unless (process-filter proc)
(set-process-filter proc 'chess-engine-filter)))
(setq chess-engine-current-marker (point-marker))
@@ -375,7 +376,7 @@
"Submit the given STRING, so ENGINE sees it in its input stream."
(chess-with-current-buffer engine
(let ((proc chess-engine-process))
- (when (and (processp proc)
+ (when (and proc (processp proc)
(not (memq (process-status proc) '(run open))))
(chess-message 'engine-not-running)
(chess-engine-command nil 'destroy))
@@ -393,7 +394,7 @@
(defun chess-engine-filter (proc &optional string)
"Filter for receiving text for an engine from an outside source."
- (let ((buf (if (processp proc)
+ (let ((buf (if (and proc (processp proc))
(process-buffer proc)
(current-buffer)))
last-point)
diff --git a/chess-gnuchess.el b/chess-gnuchess.el
index 5de6a73..401e14c 100644
--- a/chess-gnuchess.el
+++ b/chess-gnuchess.el
@@ -41,10 +41,11 @@
(cond
((eq event 'initialize)
(let ((proc (chess-common-handler game 'initialize "gnuchess")))
- (when (and (processp proc)
+ (when (and proc (processp proc)
(eq (process-status proc) 'run))
(process-send-string proc "nopost\n")
- (setq chess-engine-opponent-name "GnuChess")
+ (setq chess-engine-process proc
+ chess-engine-opponent-name "GnuChess")
t)))
((eq event 'setup-pos)
diff --git a/chess-ics.el b/chess-ics.el
index dfe9774..f83632b 100644
--- a/chess-ics.el
+++ b/chess-ics.el
@@ -20,7 +20,8 @@ The format of each entry is:
(SERVER PORT [HANDLE] [PASSWORD-OR-FILENAME] [HELPER] [HELPER ARGS...])"
:type '(repeat (list (string :tag "Server")
(integer :tag "Port")
- (string :tag "Handle")
+ (choice (const :tag "Login as guest" nil)
+ (string :tag "Handle"))
(choice (const :tag "No password or ask" nil)
(string :tag "Password")
(file :tag "Filename"))
@@ -72,8 +73,7 @@ The format of each entry is:
(lambda ()
(let ((chess-engine-pending-offer 'abort))
(funcall chess-engine-response-handler 'accept)))))
- (cons "<12> \\(.+\\)"
- 'chess-ics-handle-move)
+ (cons "<12>\\s-+\\(.+\\)" 'chess-ics-handle-move)
(cons "\\S-+ would like to take back \\([0-9]+\\) half move(s)."
(function
(lambda ()
@@ -92,7 +92,8 @@ The format of each entry is:
(function
(lambda ()
(if (string= (match-string 1) chess-engine-opponent-name)
- (funcall chess-engine-response-handler 'flag-fell)))))
+ (funcall chess-engine-response-handler 'flag-fell)
+ (funcall chess-engine-response-handler 'call-flag t)))))
(cons "Illegal move (\\([^)]+\\))\\."
(function
(lambda ()
@@ -323,22 +324,23 @@ who is black."
(chess-message 'ics-connecting (nth 0 server))
- (let ((buf (apply 'make-comint "chess-ics"
- (if (nth 4 server)
- (cons (nth 4 server) (nth 5 server))
- (list (cons (nth 0 server) (nth 1 server)))))))
+ (let ((buf (if (nth 4 server)
+ (apply 'make-comint "chess-ics"
+ (nth 4 server) nil (nth 5 server))
+ (apply 'make-comint "chess-ics"
+ (cons (nth 0 server) (nth 1 server))))))
(chess-message 'ics-connected (nth 0 server))
(display-buffer buf)
(set-buffer buf)
- (add-hook 'comint-output-filter-functions 'chess-engine-filter t t)
-
(setq chess-ics-server server
comint-prompt-regexp "^[^%\n]*% *"
comint-scroll-show-maximum-output t)
+ (add-hook 'comint-output-filter-functions 'chess-engine-filter t t)
+
(if (null (nth 2 server))
(setq chess-ics-handle "guest")
(setq chess-ics-handle (nth 2 server)
@@ -352,6 +354,11 @@ who is black."
pass))))))
t)
+ ((eq event 'ready)
+ (chess-game-run-hooks game 'announce-autosave))
+
+ ((eq event 'busy)) ; ICS will inform them
+
((eq event 'match)
(setq chess-engine-pending-offer 'match)
(chess-engine-send
diff --git a/chess-irc.el b/chess-irc.el
index a7f5abb..d2133d0 100644
--- a/chess-irc.el
+++ b/chess-irc.el
@@ -67,7 +67,8 @@
proc (open-network-stream "*chess-irc*" (current-buffer)
chess-irc-server chess-irc-port))
(chess-message 'irc-logging-in chess-irc-nick)
- (when (and proc (eq (process-status proc) 'open))
+ (when (and proc (processp proc)
+ (eq (process-status proc) 'open))
(process-send-string proc (format "USER %s 0 * :%s\n"
(user-login-name)
chess-full-name))
@@ -96,7 +97,7 @@
(format "PRIVMSG %s :%s\n"
chess-irc-opponent (car args)))))
(t
- (apply 'chess-network-handler event args)))))
+ (apply 'chess-network-handler game event args)))))
;; This filter translates IRC syntax into basic chess-network protocol
(defun chess-irc-filter (proc string)
diff --git a/chess-network.el b/chess-network.el
index 18f1c58..143e758 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -127,7 +127,8 @@
(open-network-stream "*chess-network*" (current-buffer)
(read-string "Host: ")
(read-string "Port: "))))
- (setq chess-network-kind (if (eq which ?s) 'server 'client))
+ (setq chess-engine-process proc
+ chess-network-kind (if (eq which ?s) 'server 'client))
t))
((eq event 'ready) ; don't set active yet
diff --git a/chess-phalanx.el b/chess-phalanx.el
index f3b5ffa..3353b67 100644
--- a/chess-phalanx.el
+++ b/chess-phalanx.el
@@ -31,10 +31,11 @@
(cond
((eq event 'initialize)
(let ((proc (chess-common-handler game 'initialize "phalanx")))
- (when (and (processp proc)
+ (when (and proc (processp proc)
(eq (process-status proc) 'run))
(process-send-string proc "nopost\n")
- (setq chess-engine-opponent-name "Phalanx")
+ (setq chess-engine-process proc
+ chess-engine-opponent-name "Phalanx")
t)))
(t
diff --git a/chess-transport.el b/chess-transport.el
index 9911a3f..12dce9a 100644
--- a/chess-transport.el
+++ b/chess-transport.el
@@ -33,7 +33,7 @@
(t
;; Pass all other events down to chess-network
- (apply 'chess-network-handler event args)))))
+ (apply 'chess-network-handler game event args)))))
;; Call `(chess-engine-submit engine STRING)' for text that arrives
;; from the inbound transport
diff --git a/chess-ucb.el b/chess-ucb.el
index c0b37c0..b553428 100644
--- a/chess-ucb.el
+++ b/chess-ucb.el
@@ -46,8 +46,9 @@
;; jww (2002-04-25): cat is not bidirectional, so I need
;; something like "nc" that can talk with characters devices
;; at 9600 8N1.
- (start-process "*chess-ucb*" (current-buffer)
- (executable-find "cat") chess-ucb-device)
+ (setq chess-engine-process
+ (start-process "*chess-ucb*" (current-buffer)
+ (executable-find "cat") chess-ucb-device))
t))
((memq event 'orient)