[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 183/255: explicit connection method for back-end objects
From: |
Eric Schulte |
Subject: |
[elpa] 183/255: explicit connection method for back-end objects |
Date: |
Sun, 16 Mar 2014 01:02:45 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit 8e62bd0d698f76c8d93c5e1568e5bfba9da98c89
Author: Eric Schulte <address@hidden>
Date: Sun May 19 12:06:42 2013 -0600
explicit connection method for back-end objects
---
back-ends/gnugo.el | 5 ++++-
back-ends/igs.el | 13 +++++++------
go-api.el | 1 +
go.el | 1 +
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/back-ends/gnugo.el b/back-ends/gnugo.el
index dd1a676..54f41c4 100644
--- a/back-ends/gnugo.el
+++ b/back-ends/gnugo.el
@@ -85,7 +85,10 @@
;;; Class and interface
(defclass gnugo (gtp)
- ((buffer :initarg :buffer :accessor buffer :initform (gnugo-start-process))))
+ ((buffer :initarg :buffer :accessor buffer)))
+
+(defmethod go-connect ((gnugo gnugo))
+ (setf (buffer gnugo) (gnugo-start-process)))
(defmethod gtp-command ((gnugo gnugo) command)
(gnugo-command-to-string gnugo command))
diff --git a/back-ends/igs.el b/back-ends/igs.el
index 056c8f2..04c7f5c 100644
--- a/back-ends/igs.el
+++ b/back-ends/igs.el
@@ -162,22 +162,21 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(mapc (lambda (s) (igs-filter-process proc s)) lines)))
(when moving (goto-char (process-mark proc))))))
-(defun igs-connect ()
+(defun igs-connect (igs)
"Open a connection to `igs-server'."
(interactive)
(flet ((wait (prompt)
(while (and (goto-char (or comint-last-input-end (point-min)))
(not (re-search-forward prompt nil t)))
(accept-process-output proc))))
- (let ((igs-instance (make-instance 'igs))
- (buffer (apply 'make-comint
+ (let ((buffer (apply 'make-comint
igs-process-name
igs-telnet-command nil
(list igs-server (number-to-string igs-port)))))
- (setf (buffer igs-instance) buffer)
+ (setf (buffer igs) buffer)
(with-current-buffer buffer
(comint-mode)
- (set (make-local-variable '*igs-instance*) igs-instance)
+ (set (make-local-variable '*igs-instance*) igs)
(set (make-local-variable '*igs-ready*) nil)
(set (make-local-variable '*igs-games*) nil)
(set (make-local-variable '*igs-current-game*) nil)
@@ -191,7 +190,7 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(igs-toggle "client" t)
(set-process-filter proc 'igs-insertion-filter))
(igs-games))
- igs-instance)))
+ buffer)))
(defun igs-toggle (setting value)
(igs-send (format "toggle %s %s" setting (if value "true" "false"))))
@@ -366,6 +365,8 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(defclass igs ()
((buffer :initarg :buffer :accessor buffer :initform nil)))
+(defmethod go-connect ((igs igs)) (igs-connect igs))
+
(defmacro with-igs (igs &rest body)
(declare (indent 1))
`(with-current-buffer (buffer ,igs) ,@body))
diff --git a/go-api.el b/go-api.el
index 6238fb1..2ea36cd 100644
--- a/go-api.el
+++ b/go-api.el
@@ -68,6 +68,7 @@
go-player-prisoners "Access current BACK-END player prisoners.")
;; sending messages to the back-end
+(defgeneric go-connect (back-end) "Connect to BACK-END.")
(defgeneric go-undo (back-end) "Send undo to BACK-END.")
(defgeneric go-pass (back-end) "Send pass to BACK-END.")
(defgeneric go-resign (back-end) "Send resign to BACK-END.")
diff --git a/go.el b/go.el
index 26ecac5..974f2b6 100644
--- a/go.el
+++ b/go.el
@@ -53,6 +53,7 @@
(size (read (org-icompleting-read
"board size: "
(mapcar #'number-to-string '(19 13 9))))))
+ (go-connect it)
(setf (go-size it) size)
it))
- [elpa] 167/255: cleanup images in board faces, (continued)
- [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, 2014/03/15
- [elpa] 183/255: explicit connection method for back-end objects,
Eric Schulte <=
- [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
- [elpa] 194/255: notes on scaling image sizes, Eric Schulte, 2014/03/15