summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chess-algebraic.el2
-rw-r--r--chess-autosave.el4
-rw-r--r--chess-database.el3
-rw-r--r--chess-display.el20
-rw-r--r--chess-engine.el2
-rw-r--r--chess-ics.el9
-rw-r--r--chess-link.el4
-rw-r--r--chess-pgn.el35
-rw-r--r--chess-scid.el7
-rw-r--r--chess.el2
10 files changed, 31 insertions, 57 deletions
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 1c0c1c8..0c1fa67 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -107,7 +107,7 @@ This regexp handles both long and short form.")
candidates nil)
(setq candidates (cdr candidates))))
(if (null which)
- (chess-error could-not-clarify)
+ (chess-error 'could-not-clarify)
(list which target))))
(chess-error 'no-candidates move))))))
(if promotion
diff --git a/chess-autosave.el b/chess-autosave.el
index 58a07c0..afcadba 100644
--- a/chess-autosave.el
+++ b/chess-autosave.el
@@ -25,8 +25,8 @@
(if (file-readable-p chess-autosave-file)
(if (y-or-n-p (chess-string 'chess-read-autosave))
(prog1
- (chess-game-copy-game game
- (chess-read-game chess-autosave-file))
+ (chess-game-copy-game
+ game (chess-autosave-read chess-autosave-file))
(delete-file chess-autosave-file))
(ignore
(if (y-or-n-p (chess-string 'chess-delete-autosave))
diff --git a/chess-database.el b/chess-database.el
index 35cbc44..68c318a 100644
--- a/chess-database.el
+++ b/chess-database.el
@@ -14,7 +14,8 @@
(defun chess-database-open (module file)
"Returns the opened database object, or nil."
(let* ((name (symbol-name module))
- (handler (intern-soft (concat name "-handler"))))
+ (handler (intern-soft (concat name "-handler")))
+ buffer)
(unless handler
(chess-error 'no-such-database name))
(when (setq buffer (funcall handler 'open file))
diff --git a/chess-display.el b/chess-display.el
index 68400ae..96602fc 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -72,7 +72,9 @@ Special characters include:
(defun chess-display-create (game style perspective)
"Create a chess display, for displaying chess objects."
(let ((chess-display-style style))
- (chess-module-create 'chess-display game "*Chessboard*")))
+ (chess-module-create 'chess-display game "*Chessboard*" perspective)))
+
+(defalias 'chess-display-destroy 'chess-module-destroy)
(defun chess-display-clone (display style perspective)
(let ((new-display (chess-display-create chess-module-game
@@ -114,7 +116,7 @@ Special characters include:
(defun chess-display-set-ply (display ply)
(chess-with-current-buffer display
- (setq chess-game-index 1)
+ (setq chess-display-index 1)
(chess-game-set-plies chess-module-game
(list ply (chess-ply-create
(chess-ply-next-pos ply))))))
@@ -130,7 +132,7 @@ the user able to scroll back and forth through the moves in the
variation. Any moves made on the board will extend/change the
variation that was passed in."
(chess-with-current-buffer display
- (setq chess-game-index (or index (chess-var-index variation)))
+ (setq chess-display-index (or index (chess-var-index variation)))
(chess-game-set-plies chess-module-game variation)))
(defun chess-display-variation (display)
@@ -149,7 +151,7 @@ This is the function to call to cause a display to view a game. It
will also update all of the listening engines and other displays to
also view the same game."
(chess-with-current-buffer display
- (chess-game-copy-game chess-display-set-game game)
+ (chess-game-copy-game chess-module-game game)
(chess-display-set-index nil (or index (chess-game-index game)))))
(defalias 'chess-display-game 'chess-module-game)
@@ -251,7 +253,7 @@ See `chess-display-type' for the different kinds of displays."
(progn
(chess-display-mode)
(setq chess-display-index (chess-game-index game)
- chess-display-perspective perspective
+ chess-display-perspective (car args)
chess-display-event-handler
(intern-soft (concat (symbol-name chess-display-style)
"-handler")))
@@ -487,7 +489,7 @@ Basically, it means we are playing, not editing or reviewing."
(cond
((search-forward "[Event " nil t)
(goto-char (match-beginning 0))
- (chess-display-copy-game display (chess-pgn-to-game)))
+ (chess-game-copy-game chess-module-game (chess-pgn-to-game)))
((looking-at (concat chess-algebraic-regexp "$"))
(let ((move (buffer-string)))
(with-current-buffer display
@@ -784,7 +786,7 @@ to the end or beginning."
'((not-your-move . "It is not your turn to move")
(game-is-over . "This game is over")))
-(defun chess-display-assert-can-move ()
+(defun chess-display-assert-can-move (position)
(if (and (chess-display-active-p)
;; `active' means we're playing against an engine
(chess-game-data chess-module-game 'active)
@@ -843,7 +845,7 @@ to the end or beginning."
(let* ((position (chess-display-position nil))
(color (chess-pos-side-to-move position))
char)
- (chess-display-assert-can-move)
+ (chess-display-assert-can-move position)
(unless (memq last-command '(chess-keyboard-shortcut
chess-keyboard-shortcut-delete))
(setq chess-move-string nil))
@@ -949,7 +951,7 @@ Clicking once on a piece selects it; then click on the target location."
(throw 'message (chess-string 'move-not-legal)))
(chess-display-move nil ply)))
(setq chess-display-last-selected nil))
- (chess-display-assert-can-move)
+ (chess-display-assert-can-move position)
(let ((piece (chess-pos-piece position coord)))
(cond
((eq piece ? )
diff --git a/chess-engine.el b/chess-engine.el
index 8eb7f97..1d268da 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -275,6 +275,8 @@
(setq chess-engine-current-marker (point-marker))
(current-buffer))))))
+(defalias 'chess-engine-destroy 'chess-module-destroy)
+
(defun chess-engine-command (engine event &rest args)
(chess-with-current-buffer engine
(apply chess-module-event-handler chess-module-game event args)))
diff --git a/chess-ics.el b/chess-ics.el
index ecd898b..d0a04f3 100644
--- a/chess-ics.el
+++ b/chess-ics.el
@@ -200,17 +200,20 @@ who is black."
(if (nth 2 server)
(progn
(setq chess-ics-handle (nth 2 server))
- (comint-send-string (concat chess-ics-handle "\n"))
+ (comint-send-string (get-buffer-process (current-buffer))
+ (concat chess-ics-handle "\n"))
(let ((pass (nth 3 server)))
(when pass
(if (file-readable-p pass)
(setq pass (with-temp-buffer
(insert-file-contents file)
(buffer-string))))
- (comint-send-string (concat pass "\n")))))
+ (comint-send-string (get-buffer-process (current-buffer))
+ (concat pass "\n")))))
;; jww (2002-04-13): Have to parse out the allocated Guest
;; name from the output
- (comint-send-string "guest\n\n"))))
+ (comint-send-string (get-buffer-process (current-buffer))
+ "guest\n\n"))))
t)
((eq event 'match)
diff --git a/chess-link.el b/chess-link.el
index dd57632..11cdd63 100644
--- a/chess-link.el
+++ b/chess-link.el
@@ -55,7 +55,7 @@ engine, and the computer the second engine."
(game (chess-game-create))
(display (chess-create-display-object my-color)))
(chess-game-set-data game 'my-color my-color)
- (chess-display-set-main display)
+ (chess-module-set-leader display)
(chess-display-disable-popup display)
(condition-case err
(when (and (require first-engine-type)
@@ -78,7 +78,7 @@ engine, and the computer the second engine."
(chess-display-update display)
(chess-display-popup display))
(error
- (chess-display-destroy display)
+ (chess-module-destroy display)
(error (error-message-string err))))))
(provide 'chess-link)
diff --git a/chess-pgn.el b/chess-pgn.el
index d9af85e..91b9832 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -347,41 +347,6 @@ If INDENTED is non-nil, indent the move texts."
(goto-char (posn-point (event-start event)))))
(chess-pgn-show-position))
-(defun chess-pgn-move ()
- "Make a move from a PGN buffer."
- (interactive)
- (let ((end (point))
- coords move)
- (save-excursion
- (skip-chars-backward "^ ")
- (setq move (buffer-substring-no-properties (point) end)
- coords (chess-algebraic-to-ply chess-display-position move))
- ;; it will just get reinserted again
- (delete-region (point) end))))
-
-(defun chess-pgn-insert-move (move &optional color sequence)
- "Insert an algebraic move description into a PGN buffer.
-If move is the symbol `wait', it means reflect that we are now waiting
-for the opponent to make his move. If move is the symbol `ready', it
-means our opponent is now waiting for us to move our move. Otherwise,
-move should be a string representing the algebraic notation for the
-move."
- (while (= (char-before) ?.)
- (delete-backward-char 1))
- (cond
- ((eq move 'wait)
- (insert "..."))
- ((eq move 'ready) t)
- (t
- (if (= (char-syntax (char-before)) ? )
- (insert move))
- (if color
- (move-to-column 11 t)
- (insert ?\n (format "%d. " (1+ sequence))))))
- (let ((wind (get-buffer-window (current-buffer))))
- (if wind
- (set-window-point wind (point)))))
-
(provide 'chess-pgn)
;;; chess-pgn.el ends here
diff --git a/chess-scid.el b/chess-scid.el
index 965673c..2bdb8e5 100644
--- a/chess-scid.el
+++ b/chess-scid.el
@@ -48,7 +48,7 @@
(string-to-int (chess-scid-get-result "sc_base numGames\n")))
((eq event 'read)
- (let ((here (point-max)))
+ (let ((here (point-max)) game)
(process-send-string chess-scid-process
(format "sc_game load %d\nsc_game pgn\n"
(car args)))
@@ -56,7 +56,7 @@
(goto-char here)
(when (setq game (chess-pgn-to-game))
(chess-game-set-data game 'database (current-buffer))
- (chess-game-set-data game 'database-index index)
+ (chess-game-set-data game 'database-index (car args))
(chess-game-set-data game 'database-count
(chess-scid-handler 'count))
game)))
@@ -70,7 +70,8 @@
(process-send-string chess-scid-process
(format "sc_game import \"%s\"\n"
(chess-game-to-string (cadr args))))
- (process-send-string chess-scid-process "sc_game save %d\n" index)))))
+ (process-send-string chess-scid-process
+ (format "sc_game save %d\n" index))))))
(provide 'chess-scid)
diff --git a/chess.el b/chess.el
index 0aaff7e..e99e697 100644
--- a/chess.el
+++ b/chess.el
@@ -209,7 +209,7 @@ available."
(defun chess-create-display-object (perspective)
(car (chess-create-modules (list chess-default-display)
'chess--create-display
- (chess-mage-create) perspective)))
+ (chess-game-create) perspective)))
;;;###autoload
(defun chess-read-pgn (&optional file)