[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: * chess-test.el (chess-test): Renamed to... (chess-test-da
From: |
Mario Lang |
Subject: |
[elpa] 01/01: * chess-test.el (chess-test): Renamed to... (chess-test-database): More descriptive name. (chess-perft): Require as this is our entry-point for testing. * doc/chess.texi: Renamed to... * chess.texi: Top-level file, keeping doc/ for just one file is useless. * Makefile: Adjust and use the predefined MAKEINFO variable from GNU Make. * chess-pgn.el (chess-game): Require. (chess-pgn-parse): Use `rx'. * chess-game.el (chess-pgn): Do not require. (chess-game-to-string, chess-game-from-string): Remove, all callers updated to use chess-pgn functions directly. |
Date: |
Sat, 14 Jun 2014 14:08:32 +0000 |
mlang pushed a commit to branch externals/chess
in repository elpa.
commit e8725641a89ef55181f9e27750faeb0c44e678ab
Author: Mario Lang <address@hidden>
Date: Sat Jun 14 16:08:04 2014 +0200
* chess-test.el (chess-test): Renamed to...
(chess-test-database): More descriptive name.
(chess-perft): Require as this is our entry-point for testing.
* doc/chess.texi: Renamed to...
* chess.texi: Top-level file, keeping doc/ for just one file is useless.
* Makefile: Adjust and use the predefined MAKEINFO variable from GNU Make.
* chess-pgn.el (chess-game): Require.
(chess-pgn-parse): Use `rx'.
* chess-game.el (chess-pgn): Do not require.
(chess-game-to-string, chess-game-from-string): Remove, all callers
updated to use chess-pgn functions directly.
---
.elpaignore | 1 -
ChangeLog | 12 ++++++++++++
Makefile | 13 ++++++-------
chess-crafty.el | 3 ++-
chess-file.el | 1 +
chess-game.el | 11 -----------
chess-gnuchess.el | 3 ++-
chess-network.el | 3 ++-
chess-pgn.el | 26 +++++++++++++++++++-------
chess-sjeng.el | 3 ++-
chess-test.el | 3 ++-
doc/chess.texi => chess.texi | 0
12 files changed, 48 insertions(+), 31 deletions(-)
diff --git a/.elpaignore b/.elpaignore
index b34bc39..9777460 100644
--- a/.elpaignore
+++ b/.elpaignore
@@ -3,6 +3,5 @@
.elpaignore
chess-eco.pos
chess-test.el
-doc
ChangeLog
Makefile
diff --git a/ChangeLog b/ChangeLog
index 400a5e6..798ff02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2014-06-14 Mario Lang <address@hidden>
+ * chess-test.el (chess-test): Renamed to...
+ (chess-test-database): More descriptive name.
+ (chess-perft): Require as this is our entry-point for testing.
+ * doc/chess.texi: Renamed to...
+ * chess.texi: Top-level file, keeping doc/ for just one file is useless.
+ * Makefile: Adjust and use the predefined MAKEINFO variable from GNU
Make.
+ * chess-pgn.el (chess-game): Require.
+ (chess-pgn-parse): Use `rx'.
+ * chess-game.el (chess-pgn): Do not require.
+ (chess-game-to-string, chess-game-from-string): Remove, all callers
+ updated to use chess-pgn functions directly.
+
* chess-algebraic.el (chess-ply-to-algebraic): If TYPE is `:numeric',
generate ICCF numeric notation.
(chess-algebraic-regexp, chess-algebraic-to-ply): Optionally allow "0-0"
diff --git a/Makefile b/Makefile
index 5b1bfa8..4c9f462 100644
--- a/Makefile
+++ b/Makefile
@@ -4,25 +4,24 @@
# If you update chess.texi or chess-eco.pos, run make on this file.
EMACS = emacs --batch --no-site-file
-MAKEINFO = makeinfo
+MAKEINFO_FLAGS = --no-split
INSTALL_INFO = install-info
all: chess-eco.fen chess.info dir
-test: chess-perft.elc
- $(EMACS) -L . -l chess-perft -f ert-run-tests-batch
+test: chess-test.elc
+ $(EMACS) -L . -l chess-test -f ert-run-tests-batch
chess-eco.fen: chess-eco.pos
$(EMACS) -L . -l chess-eco.el -f chess-generate-fen-table $< $@
-chess.info: doc/chess.texi
- $(MAKEINFO) --no-split -o $@ $<
-
dir: chess.info
$(INSTALL_INFO) $< $@
+chess-database.elc: chess-message.elc chess-file.elc chess-scid.elc
+chess-file.elc: chess-fen.elc chess-pgn.elc
chess-perft.elc: chess-fen.elc chess-ply.elc chess-pos.elc
-chess-ply.elc: chess-algebraic.elc
+chess-test.elc: chess-database.elc chess-game.elc chess-perft.elc
.el.elc:
@$(EMACS) -L . -f batch-byte-compile $<
diff --git a/chess-crafty.el b/chess-crafty.el
index 24265ed..3335f8e 100644
--- a/chess-crafty.el
+++ b/chess-crafty.el
@@ -23,6 +23,7 @@
(require 'chess-common)
(require 'chess-fen)
+(require 'chess-pgn)
(require 'chess-var)
(defgroup chess-crafty nil
@@ -150,7 +151,7 @@
((eq event 'setup-game)
(let ((file (chess-with-temp-file
- (insert (chess-game-to-string (car args)) ?\n))))
+ (chess-insert-pgn (car args)) (insert ?\n))))
(chess-engine-send nil (format "read %s\n" file))))
((eq event 'set-option)
diff --git a/chess-file.el b/chess-file.el
index 1b3028b..95a5e9e 100644
--- a/chess-file.el
+++ b/chess-file.el
@@ -28,6 +28,7 @@
;;; Code:
(require 'chess-fen)
+(require 'chess-pgn)
(defvar chess-file-locations nil
"A list of starting positions of individual records of this collection.")
diff --git a/chess-game.el b/chess-game.el
index a61438a..d86f159 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -28,7 +28,6 @@
(eval-when-compile (require 'cl-lib))
(require 'chess-ply)
-(require 'chess-pgn)
(defvar chess-game-inhibit-events nil)
@@ -267,16 +266,6 @@ If INDEX is non-nil, the last played ply is returned."
(and last-ply (chess-ply-final-p last-ply))))
-(defsubst chess-game-to-string (game &optional indented)
- "Convert GAME to a string in PGN format."
- (cl-assert game)
- (chess-game-to-pgn game indented t))
-
-(defsubst chess-game-from-string (pgn)
- "Convert a PGN format string to a chess game object."
- (cl-check-type pgn string)
- (chess-pgn-to-game pgn))
-
(defsubst chess-game-copy-game (game new-game)
(cl-assert game)
(cl-assert new-game)
diff --git a/chess-gnuchess.el b/chess-gnuchess.el
index 248267c..db23b19 100644
--- a/chess-gnuchess.el
+++ b/chess-gnuchess.el
@@ -23,6 +23,7 @@
(require 'chess-common)
(require 'chess-fen)
+(require 'chess-pgn)
(defgroup chess-gnuchess nil
"The publically available chess engine 'gnuchess'."
@@ -79,7 +80,7 @@
(if (zerop (chess-game-index (car args)))
(chess-gnuchess-handler game 'setup-pos (chess-game-pos game 0))
(let ((file (chess-with-temp-file
- (insert (chess-game-to-string (car args)) ?\n))))
+ (chess-insert-pgn (car args)) (insert ?\n))))
(chess-engine-send nil (format "pgnload %s\n" file)))))
((eq event 'pass)
diff --git a/chess-network.el b/chess-network.el
index a5f3ef4..c9a6b3d 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -23,6 +23,7 @@
(require 'chess-common)
(require 'chess-fen)
+(require 'chess-pgn)
(defvar chess-network-regexp-alist
(list
@@ -165,7 +166,7 @@
((eq event 'setup-game)
(chess-engine-send nil (format "pgn %s\n"
(chess-network-flatten-multiline
- (chess-game-to-string (car args))))))
+ (chess-game-to-pgn (car args) nil t)))))
((eq event 'pass)
(chess-engine-send nil "pass\n"))
diff --git a/chess-pgn.el b/chess-pgn.el
index 14cec7a..9c9c647 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -54,10 +54,15 @@
;;; Code:
+(require 'chess)
(require 'chess-algebraic)
+(require 'chess-display)
(require 'chess-fen)
+(require 'chess-game)
(require 'chess-ply)
(require 'chess-message)
+(require 'mm-decode)
+(require 'mm-view)
(eval-when-compile
(require 'pcomplete nil t))
@@ -151,15 +156,21 @@ Optionally use the supplied STRING instead of the current
buffer."
(goto-char (match-beginning 0))))
(let ((game (chess-game-create)))
(chess-game-set-tags game nil)
- (while (looking-at "\\[\\(\\S-+\\)\\s-+\\(\".*?\"\\)\\][ \t\n\r]+")
+ (while (looking-at (rx
+ ?[ (group (one-or-more (not (syntax whitespace))))
+ (one-or-more (syntax whitespace))
+ (syntax string-quote)
+ (group (*? not-newline))
+ (syntax string-quote)
+ ?]
+ (one-or-more (char ? ?\n ?\r ?\t))))
(chess-game-set-tag game (match-string-no-properties 1)
- (let ((str (match-string-no-properties 2)))
- (substring str 1 (1- (length str)))))
+ (match-string-no-properties 2))
(goto-char (match-end 0)))
(let ((fen (chess-game-tag game "FEN")))
- (if fen
- (chess-game-set-start-position game (chess-fen-to-pos fen)))
- (chess-game-set-plies game (chess-pgn-read-plies game (chess-game-pos
game) t)))
+ (when fen
+ (chess-game-set-start-position game (chess-fen-to-pos fen))))
+ (chess-game-set-plies game (chess-pgn-read-plies game (chess-game-pos
game) t))
game)
(error "Data not in legal PGN format: '%s'"
(buffer-substring (point) (point-max)))))
@@ -254,7 +265,6 @@ PGN text."
;;
(require 'chess-database)
-(require 'chess-file)
(defvar chess-pgn-database nil
"Chess database object.")
@@ -384,6 +394,8 @@ PGN text."
(setq ply (1+ ply)))
ply))))
+(defvar chess-file-locations nil)
+
(defun chess-pgn-read-game ()
"Load a database to represent this file if not already up."
(unless chess-pgn-database
diff --git a/chess-sjeng.el b/chess-sjeng.el
index a042258..4e2bc41 100644
--- a/chess-sjeng.el
+++ b/chess-sjeng.el
@@ -22,6 +22,7 @@
(require 'chess-common)
(require 'chess-fen)
+(require 'chess-pgn)
(defgroup chess-sjeng nil
"The publically available chess engine 'sjeng'."
@@ -95,7 +96,7 @@
((eq event 'setup-game)
(let ((file (chess-with-temp-file
- (insert (chess-game-to-string (car args)) ?\n))))
+ (chess-insert-pgn (car args)) (insert ?\n))))
(chess-engine-send nil (format "read %s\n" file))))
((eq event 'set-option)
diff --git a/chess-test.el b/chess-test.el
index 55d951d..5d95195 100644
--- a/chess-test.el
+++ b/chess-test.el
@@ -25,8 +25,9 @@
(require 'chess-database)
(require 'chess-game)
+(require 'chess-perft)
-(defun chess-test (&optional file start count)
+(defun chess-test-database (&optional file start count)
(unless file
(setq file (nth 0 command-line-args-left)))
(unless start
diff --git a/doc/chess.texi b/chess.texi
similarity index 100%
rename from doc/chess.texi
rename to chess.texi
- [elpa] branch externals/chess updated (3a44294 -> e872564), Mario Lang, 2014/06/14
- [elpa] 01/01: * chess-test.el (chess-test): Renamed to... (chess-test-database): More descriptive name. (chess-perft): Require as this is our entry-point for testing. * doc/chess.texi: Renamed to... * chess.texi: Top-level file, keeping doc/ for just one file is useless. * Makefile: Adjust and use the predefined MAKEINFO variable from GNU Make. * chess-pgn.el (chess-game): Require. (chess-pgn-parse): Use `rx'. * chess-game.el (chess-pgn): Do not require. (chess-game-to-string, chess-game-from-string): Remove, all callers updated to use chess-pgn functions directly.,
Mario Lang <=