[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 156/255: chunking responses from IGS server into full lines
From: |
Eric Schulte |
Subject: |
[elpa] 156/255: chunking responses from IGS server into full lines |
Date: |
Sun, 16 Mar 2014 01:02:39 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit 9cc13dcae2b5512df6408c696d1eaf8fa7fadc3b
Author: Eric Schulte <address@hidden>
Date: Sun Jun 3 14:36:13 2012 -0600
chunking responses from IGS server into full lines
---
back-ends/igs.el | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/back-ends/igs.el b/back-ends/igs.el
index b3ec70c..37e22e1 100644
--- a/back-ends/igs.el
+++ b/back-ends/igs.el
@@ -110,6 +110,9 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(defvar *igs-current-game* nil
"Number of the current IGS game (may change frequently).")
+(defvar *igs-partial-line* nil
+ "Holds partial lines of input from an IGS process.")
+
(defmacro igs-w-proc (proc &rest body)
(declare (indent 1))
`(with-current-buffer (process-buffer proc) ,@body))
@@ -146,8 +149,15 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(goto-char (process-mark proc))
(insert string)
(set-marker (process-mark proc) (point))
- (mapc (lambda (s) (igs-filter-process proc s))
- (split-string string "[\n\r]")))
+ (let ((lines (split-string (if *igs-partial-line*
+ (concat *igs-partial-line* string)
+ string)
+ "[\n\r]")))
+ (if (string-match "[\n\r]$" (car (last lines)))
+ (setf *igs-partial-line* nil)
+ (setf *igs-partial-line* (car (last lines)))
+ (setf lines (butlast lines)))
+ (mapc (lambda (s) (igs-filter-process proc s)) lines)))
(when moving (goto-char (process-mark proc))))))
(defun igs-connect ()
@@ -169,6 +179,7 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(set (make-local-variable '*igs-ready*) nil)
(set (make-local-variable '*igs-games*) nil)
(set (make-local-variable '*igs-current-game*) nil)
+ (set (make-local-variable '*igs-partial-line*) nil)
(set (make-local-variable '*igs-time-last-sent*) (current-time))
(let ((proc (get-buffer-process (current-buffer))))
(wait "^Login:")
@@ -197,8 +208,7 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(defun igs-game-list (igs)
(let (games)
- (with-current-buffer (buffer igs)
- (setq games *igs-games*))
+ (with-igs igs (setq games *igs-games*))
(let* ((my-games (copy-seq games))
(list-buf (get-buffer-create "*igs-game-list*")))
(with-current-buffer (pop-to-buffer list-buf)
@@ -357,9 +367,11 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(defmethod go-name ((igs igs))
(with-igs igs (let ((game (igs-current-game)))
- (format "%s vs %s"
+ (format "%s(%s) vs %s(%s)"
(aget game :white-name)
- (aget game :black-name)))))
+ (aget game :white-rank)
+ (aget game :black-name)
+ (aget game :black-rank)))))
(defmethod set-go-name ((igs igs) name)
(signal 'unsupported-back-end-command (list igs :set-name name)))
- [elpa] 173/255: start gnugo process when object is created, (continued)
- [elpa] 173/255: start gnugo process when object is created, Eric Schulte, 2014/03/15
- [elpa] 167/255: cleanup images in board faces, Eric Schulte, 2014/03/15
- [elpa] 170/255: fix spacing of labels when using image for display, Eric Schulte, 2014/03/15
- [elpa] 174/255: quit the main back-end as well, Eric Schulte, 2014/03/15
- [elpa] 160/255: removing stones/ directory, Eric Schulte, 2014/03/15
- [elpa] 175/255: support for playing different types of games, Eric Schulte, 2014/03/15
- [elpa] 157/255: images of stones, Eric Schulte, 2014/03/15
- [elpa] 177/255: future tasks, Eric Schulte, 2014/03/15
- [elpa] 182/255: reverse order of sizes, Eric Schulte, 2014/03/15
- [elpa] 172/255: re-organized how files are loaded, Eric Schulte, 2014/03/15
- [elpa] 156/255: chunking responses from IGS server into full lines,
Eric Schulte <=
- [elpa] 183/255: explicit connection method for back-end objects, Eric Schulte, 2014/03/15
- [elpa] 179/255: track and display prisoners, Eric Schulte, 2014/03/15
- [elpa] 184/255: safer and automatic quitting, Eric Schulte, 2014/03/15
- [elpa] 186/255: better interactive debugging, Eric Schulte, 2014/03/15
- [elpa] 191/255: don't throw error when backend passes, Eric Schulte, 2014/03/15
- [elpa] 185/255: remove dependencies on org-mode functions, Eric Schulte, 2014/03/15
- [elpa] 176/255: task managment, Eric Schulte, 2014/03/15
- [elpa] 178/255: process igs "tell" messages, Eric Schulte, 2014/03/15
- [elpa] 181/255: NOTES #+option, Eric Schulte, 2014/03/15
- [elpa] 193/255: calculate the final score, Eric Schulte, 2014/03/15