X-Git-Url: http://git.pond.sub.org/?p=eow;a=blobdiff_plain;f=empire.lisp;h=8a83ac0082f6a1806dab2c98a55cf48c9157b15d;hp=9f28084bbf82bc8dad8939a1adb2cf911069ba96;hb=534a13f805a930866db4a55e58bc86dc1608dce4;hpb=f1b2e494b43de565e0f4029e51d86dc6882f460c diff --git a/empire.lisp b/empire.lisp index 9f28084..8a83ac0 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,28 @@ (and (> (length line) 0) (char= +special-command-char+ (aref line 0)))) +(defclass xdump-mode (play-mode) + ((parser :initform (xdump:make-parser)) + (phase :initform :meta-meta))) + +(defmethod handle-data ((m xdump-mode) message) + (with-slots (connection parser phase) m + (if (xdump:parse-line parser message) + ;;XXX consider something like a 'pop-mode function + (ccase phase + (:meta-meta + (setf phase :meta-table + parser (xdump:make-parser)) + (send-message connection "xdump meta table")) + (:meta-table + (setf phase :table + parser (xdump:make-parser)) + (send-message connection "xdump table *")) + (:table + (set-new-mode (connection-mode connection) 'play-mode)))))) + (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))