1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00

Common Lisp: Initialize standard streams in GNU CLISP on startup

Without the initialization CLISP seems to be interacting wierdly with PERL_RL
flag
This commit is contained in:
Iqbal Ansari 2016-11-17 17:14:33 +05:30
parent e7e61f3274
commit 89676a9fba
11 changed files with 139 additions and 0 deletions

View File

@ -39,7 +39,20 @@
(defun main (&optional (argv nil argv-provided-p))
(declare (ignorable argv argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(loop do (let ((line (mal-readline "user> ")))
(if line (mal-writeline (rep line)) (return)))))

View File

@ -47,7 +47,20 @@
(defun main (&optional (argv nil argv-provided-p))
(declare (ignorable argv argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(loop do (let ((line (mal-readline "user> ")))
(if line (mal-writeline (rep line)) (return)))))

View File

@ -110,7 +110,20 @@
(defun main (&optional (argv nil argv-provided-p))
(declare (ignorable argv argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(loop do (let ((line (mal-readline "user> ")))
(if line (mal-writeline (rep line)) (return)))))

View File

@ -139,7 +139,20 @@
(defun main (&optional (argv nil argv-provided-p))
(declare (ignorable argv argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(loop do (let ((line (mal-readline "user> ")))
(if line (mal-writeline (rep line)) (return)))))

View File

@ -142,7 +142,20 @@
(defun main (&optional (argv nil argv-provided-p))
(declare (ignorable argv argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(loop do (let ((line (mal-readline "user> ")))
(if line (mal-writeline (rep line)) (return)))))

View File

@ -153,7 +153,20 @@
(defun main (&optional (argv nil argv-provided-p))
(declare (ignorable argv argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(loop do (let ((line (mal-readline "user> ")))
(if line (mal-writeline (rep line)) (return)))))

View File

@ -168,9 +168,21 @@
(rep (format nil "(load-file \"~a\")" file)))
(defun main (&optional (argv nil argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(let ((args (if argv-provided-p
argv
(cdr (utils:raw-command-line-arguments)))))

View File

@ -204,9 +204,21 @@
(rep (format nil "(load-file \"~a\")" file)))
(defun main (&optional (argv nil argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(let ((args (if argv-provided-p
argv
(cdr (utils:raw-command-line-arguments)))))

View File

@ -263,9 +263,21 @@
(rep (format nil "(load-file \"~a\")" file)))
(defun main (&optional (argv nil argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(let ((args (if argv-provided-p
argv
(cdr (utils:raw-command-line-arguments)))))

View File

@ -291,9 +291,21 @@
(rep (format nil "(load-file \"~a\")" file)))
(defun main (&optional (argv nil argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(let ((args (if argv-provided-p
argv
(cdr (utils:raw-command-line-arguments)))))

View File

@ -303,8 +303,21 @@
(rep (format nil "(load-file \"~a\")" file)))
(defun main (&optional (argv nil argv-provided-p))
(setf *use-readline-p* (not (or (string= (uiop:getenv "PERL_RL") "false")
(string= (uiop:getenv "TERM") "dumb"))))
;; In GNU CLISP's batch mode the standard-input seems to be set to some sort
;; of input string-stream, this interacts wierdly with the PERL_RL enviroment
;; variable which the test runner sets causing `read-line' on *standard-input*
;; to fail with an empty stream error. The following reinitializes the
;; standard streams
;;
;; See http://www.gnu.org/software/clisp/impnotes/streams-interactive.html
#+clisp (setf *standard-input* (ext:make-stream :input)
*standard-output* (ext:make-stream :output :buffered t)
*error-output* (ext:make-stream :error :buffered t))
(let ((args (if argv-provided-p
argv
(cdr (utils:raw-command-line-arguments)))))