(:use :common-lisp :ltk :com.gigamonkeys.pathnames)\r
(:export :terminal-in :terminal-out\r
:run-console :console-running-p :textwidth :offset :style\r
- :*text* :get-input :ltk-after :*repl-mode* :*hard-quit* :quit-lisp\r
+ :*text* :get-input :ltk-after :*repl-mode* :*no-output*\r
+ :*hard-quit* :quit-lisp\r
:close-console :load-module :print-message))\r
\r
(in-package :if-console)\r
\r
(defparameter *repl-mode* nil)\r
+(defparameter *no-output* nil)\r
(defparameter *console-on* nil)\r
(defparameter *text* nil)\r
(defparameter *inp* nil)\r
\r
(defmethod gray:stream-write-char ((s terminal-out) char)\r
(unless (console-running-p) (error "No console is running"))\r
+ (unless *no-output*\r
(if *repl-mode* (princ char)\r
(append-text (first *console-on*) \r
- (make-string 1 :initial-element char))))\r
+ (make-string 1 :initial-element char)))))\r
\r
(defmethod gray:stream-line-column ((s terminal-out))\r
(offset s))\r
(defmethod gray:stream-write-char-sequence ((s terminal-out) str\r
&optional start end)\r
(unless (console-running-p) (error "No console is running"))\r
+ (unless *no-output*\r
(let ((toprint (subseq str (if start start 0) (if end end nil))))\r
(if *repl-mode* (princ toprint)\r
(progn\r
(append-text (first *console-on*) toprint)\r
- (see (first *console-on*) "insert")))))\r
+ (see (first *console-on*) "insert"))))))\r
\r
(defmethod gray:stream-read-char ((s terminal-in))\r
(if *repl-mode* (read-char *standard-input*)\r
(defun load-module (startup lib-loader)\r
"Loads IF module into the interpreter"\r
(multiple-value-bind (file dir) (pick-file)\r
- (unless file (append-text *text* "Failed to load module.\r
-"))\r
+ (unless file (append-text *text* (format nil "Failed to load module.~%"))\r
+ (return-from load-module nil))\r
(funcall lib-loader file dir)\r
(funcall startup)))\r
\r