Make readline optional.

* gash/readline.scm: New file.
* build-aux/build-guile.sh: Compile it.
* gash/gash.scm: Use it as fallback.
This commit is contained in:
Jan Nieuwenhuizen 2018-10-29 21:13:41 +01:00
parent d2133b8502
commit f7c1dd6e72
3 changed files with 47 additions and 1 deletions

View File

@ -53,6 +53,7 @@ gash/job.scm
gash/lzw.scm
gash/peg.scm
gash/pipe.scm
gash/readline.scm
gash/script.scm
gash/ustar.scm
gash/util.scm

View File

@ -9,7 +9,6 @@
#:use-module (ice-9 local-eval)
#:use-module (ice-9 match)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 readline)
#:use-module (ice-9 pretty-print)
#:use-module (ice-9 receive)
#:use-module (ice-9 regex)
@ -30,6 +29,11 @@
parse
parse-string))
(catch #t
(lambda _ (use-modules (ice-9 readline)))
(lambda (key . args)
(use-modules (gash readline))))
(define %debug-level 0) ; 1 informational, 2 verbose, 3 peg tracing
(define %prefer-builtins? #f) ; use builtin, even if COMMAND is available in PATH?
(define %geesh-parser? #f) ; use Geesh parser [EXPERIMENTAL]

41
gash/readline.scm Normal file
View File

@ -0,0 +1,41 @@
;;; Gash -- Guile As SHell
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of Gash.
;;;
;;; Gash is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; Gash is distributed in the hope that it will be useful, but WITHOUT ANY
;;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
;;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
;;; details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; This is a fallback module for the bootstrap guile where (ice-9
;;; readline) is not available.
;;; Code:
(define-module (gash readline)
#:use-module (ice-9 rdelim)
#:export (add-history
clear-history
read-history
readline
with-readline-completion-function
write-history))
(define (add-history x) #t)
(define (clear-history) #t)
(define (read-history x) #t)
(define (readline prompt) (display prompt) (read-line))
(define (with-readline-completion-function completion thunk) (thunk))
(define (write-history x) #t)