From: Gerd Flaig Date: Tue, 30 Jun 2009 11:19:31 +0000 (+0200) Subject: start xdump-mode X-Git-Url: http://git.pond.sub.org/?p=eow;a=commitdiff_plain;h=a4f36e2bf190fa6f14347a00e309af5a3d74f159 start xdump-mode --- diff --git a/empire.lisp b/empire.lisp index 9f28084..2f3452e 100644 --- a/empire.lisp +++ b/empire.lisp @@ -208,7 +208,7 @@ (cons (let ((message (car next-event)) (mode (cdr next-event))) (send-message-one c message) - (set-new-mode c mode)))))) + (set-new-mode (connection-mode c) mode)))))) (defun read-no-eval (stream) (let ((*read-eval* nil)) @@ -302,8 +302,24 @@ (and (> (length line) 0) (char= +special-command-char+ (aref line 0)))) +(defclass xdump-mode (play-mode) + ((table-buffer + :initform nil + :accessor table-buffer + :documentation "Intermediate storage for incomplete table dump."))) + +(defmethod handle-data ((m xdump-mode) message) + (with-slots (connection table-buffer) m + (if (char= #\/ (aref message 0)) + (progn + (format t "table: ~a~%" table-buffer) + (set-new-mode m 'play-mode))) + ;XXX check table size + (with-input-from-string (s (format nil "(~a)" message)) + (setf table-buffer (cons (read s) table-buffer))))) + (defmethod special-xup ((c connection)) - t) + (send-message c "xdump meta meta" :next-mode 'xdump-mode)) (defmethod special-command ((c connection) line) (cond ((string= line "xup") (special-xup c))