Add support for Guile 2.0.9.
* gash/compat.scm: New file. * gash/compat/hash-table.scm: New file. * Makefile.am: Add them. * .dir-locals.scm: Add indentation for 'if-guile-version-below'. * guix.scm (guile-2.0.9): New variable. * gash/built-ins/echo.scm (escape->control): Use '#\esc'. * gash/environment.scm: Use '(gash compat hash-table)'. * gash/built-ins/break.scm, gash/built-ins/cd.scm, gash/built-ins/command.scm, gash/built-ins/continue.scm, gash/built-ins/dot.scm, gash/built-ins/exec.scm, gash/built-ins/exit.scm, gash/built-ins/pwd.scm, gash/built-ins/return.scm, gash/built-ins/set.scm, gash/built-ins/shift.scm, gash/built-ins/trap.scm, gash/built-ins/type.scm, gash/built-ins/umask.scm, gash/eval.scm, tests/unit/automake.scm: Use '(gash compat)'. squash! Add support for Guile 2.0.9.
This commit is contained in:
parent
3f745ae39e
commit
878b9c3dca
|
@ -6,6 +6,7 @@
|
|||
(let ((top (locate-dominating-file default-directory
|
||||
".dir-locals.el")))
|
||||
(add-to-list 'geiser-guile-load-path top))))
|
||||
(eval . (put 'if-guile-version-below 'scheme-indent-function 1))
|
||||
(eval . (put '<sh-case> 'scheme-indent-function 1))
|
||||
(eval . (put '<sh-defun> 'scheme-indent-function 1))
|
||||
(eval . (put '<sh-exec-let> 'scheme-indent-function 1))
|
||||
|
|
|
@ -37,6 +37,8 @@ GUILE_MODULES = \
|
|||
gash/built-ins/unset.scm \
|
||||
gash/built-ins/utils.scm \
|
||||
gash/built-ins.scm \
|
||||
gash/compat/hash-table.scm \
|
||||
gash/compat.scm \
|
||||
gash/config.scm \
|
||||
gash/environment.scm \
|
||||
gash/eval.scm \
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins break)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins cd)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (ice-9 match))
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
(define-module (gash built-ins command)
|
||||
#:use-module (ice-9 getopt-long)
|
||||
#:use-module (gash built-ins utils)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash config))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins continue)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
(define-module (gash built-ins dot)
|
||||
#:use-module (gash built-ins utils)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (gash parser)
|
||||
#:use-module (ice-9 match))
|
||||
|
|
|
@ -42,7 +42,9 @@
|
|||
((#\a) (cons #\alarm (loop (cdr lst))))
|
||||
((#\b) (cons #\backspace (loop (cdr lst))))
|
||||
((#\c) '())
|
||||
((#\e) (cons #\escape (loop (cdr lst))))
|
||||
;; Guile 2.0.9 does not understand '#\escape',
|
||||
;; so we use the older '#\esc'.
|
||||
((#\e) (cons #\esc (loop (cdr lst))))
|
||||
((#\f) (cons #\page (loop (cdr lst))))
|
||||
((#\n) (cons #\newline (loop (cdr lst))))
|
||||
((#\r) (cons #\return (loop (cdr lst))))
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins exec)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1))
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins exit)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins pwd)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (ice-9 match))
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins return)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins set)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (ice-9 match))
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins shift)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1))
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins trap)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (ice-9 match))
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
(define-module (gash built-ins type)
|
||||
#:use-module (ice-9 getopt-long)
|
||||
#:use-module (gash built-ins utils)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash config))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash built-ins umask)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (ice-9 match))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
;;; Gash -- Guile As SHell
|
||||
;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
|
||||
;;;
|
||||
;;; 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/>.
|
||||
|
||||
(define-module (gash compat)
|
||||
#:export (if-guile-version-below))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
;;; This module fills in for features that are missing in older
|
||||
;;; versions of the '(guile)' module.
|
||||
;;;
|
||||
;;; Code:
|
||||
|
||||
(define-syntax if-guile-version-below
|
||||
(lambda (x)
|
||||
(define (guile-version<? major minor micro)
|
||||
(let ((g-major (string->number (major-version)))
|
||||
(g-minor (string->number (minor-version)))
|
||||
(g-micro (string->number (micro-version))))
|
||||
(or (< g-major major)
|
||||
(and (= g-major major)
|
||||
(< g-minor minor))
|
||||
(and (= g-major major)
|
||||
(= g-minor minor)
|
||||
(< g-micro micro)))))
|
||||
|
||||
(syntax-case x ()
|
||||
((_ (maj min mic) consequent alternate)
|
||||
(if (guile-version<? (syntax->datum #'maj)
|
||||
(syntax->datum #'min)
|
||||
(syntax->datum #'mic))
|
||||
#'consequent
|
||||
#'alternate)))))
|
||||
|
||||
(if-guile-version-below (2 0 10)
|
||||
(begin
|
||||
(define-public EXIT_SUCCESS 0)
|
||||
|
||||
(define-public EXIT_FAILURE 1)
|
||||
|
||||
(define-public (exact-integer? x)
|
||||
(and (integer? x) (exact? x))))
|
||||
#f)
|
|
@ -0,0 +1,39 @@
|
|||
;;; Gash -- Guile As SHell
|
||||
;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
|
||||
;;;
|
||||
;;; 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/>.
|
||||
|
||||
(define-module (gash compat hash-table)
|
||||
#:use-module (gash compat))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
;;; The '(ice-9 hash-table)' module was introduced into Guile in
|
||||
;;; version 2.0.10, so we provide a shim.
|
||||
;;;
|
||||
;;; Code:
|
||||
|
||||
(if-guile-version-below (2 0 10)
|
||||
(begin
|
||||
(define-public (alist->hash-table alist)
|
||||
(let ((table (make-hash-table)))
|
||||
(for-each (lambda (pair)
|
||||
(hash-set! table (car pair) (cdr pair)))
|
||||
(reverse alist))
|
||||
table)))
|
||||
(begin
|
||||
(use-modules (ice-9 hash-table))
|
||||
(re-export alist->hash-table)))
|
|
@ -18,7 +18,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash environment)
|
||||
#:use-module (ice-9 hash-table)
|
||||
#:use-module (gash compat hash-table)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gash eval)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (gash shell)
|
||||
#:use-module (gash word)
|
||||
|
|
17
guix.scm
17
guix.scm
|
@ -7,6 +7,7 @@
|
|||
(gnu packages texinfo)
|
||||
(guix build utils)
|
||||
(guix build-system gnu)
|
||||
(guix download)
|
||||
(guix gexp)
|
||||
((guix licenses) #:prefix license:)
|
||||
(guix packages)
|
||||
|
@ -47,6 +48,22 @@
|
|||
(or (eq? (stat:type stat) 'directory)
|
||||
(member relative paths)))))
|
||||
|
||||
(define guile-2.0.9
|
||||
(package
|
||||
(inherit guile-2.0)
|
||||
(version "2.0.9")
|
||||
(source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "mirror://gnu/guile/guile-" version ".tar.xz"))
|
||||
(sha256
|
||||
(base32
|
||||
"0nw9y8vjyz4r61v06p9msks5lm58pd91irmzg4k487vmv743h2pp"))))
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments guile-2.0)
|
||||
;; XXX: There are some encoding and network test failures.
|
||||
((#:tests? _ #f) #f)))))
|
||||
|
||||
(package
|
||||
(name "gash")
|
||||
(version *version*)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (tests unit automake)
|
||||
#:use-module (gash compat)
|
||||
#:use-module (srfi srfi-64))
|
||||
|
||||
;;; Commentary:
|
||||
|
|
Loading…
Reference in New Issue