Prefer 'if-guile-version-below' to 'cond-expand'.

* gash/compat.scm: Use 'if-guile-version-below' over 'cond-expand'.
* gash/compat/textual-ports.scm: Ditto.
This commit is contained in:
Timothy Sample 2019-05-20 00:30:41 -04:00
parent 2d46b8b43e
commit 669c414116
2 changed files with 28 additions and 28 deletions

View File

@ -57,13 +57,13 @@
(and (integer? x) (exact? x)))) (and (integer? x) (exact? x))))
#f) #f)
(cond-expand (if-guile-version-below (2 2 0)
((and guile-2 (not guile-2.2)) (begin
(define* (setvbuf port mode #:optional size) (define* (setvbuf port mode #:optional size)
(let ((mode (match mode (let ((mode (match mode
('none _IONBF) ('none _IONBF)
('line _IOLBF) ('line _IOLBF)
('block _IOFBF)))) ('block _IOFBF))))
((@ (guile) setvbuf) port mode size))) ((@ (guile) setvbuf) port mode size)))
(export! setvbuf)) (export! setvbuf))
(else #f)) #f)

View File

@ -16,7 +16,8 @@
;;; You should have received a copy of the GNU General Public License ;;; You should have received a copy of the GNU General Public License
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>. ;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
(define-module (gash compat textual-ports)) (define-module (gash compat textual-ports)
#:use-module (gash compat))
;;; Commentary: ;;; Commentary:
;;; ;;;
@ -25,20 +26,19 @@
;;; ;;;
;;; Code: ;;; Code:
(cond-expand (if-guile-version-below (2 2 0)
((and guile-2 (not guile-2.2)) (begin
(use-modules (rnrs io ports)) (use-modules (rnrs io ports))
(define (unget-char port char) (re-export get-char
(unread-char char port)) get-line
(re-export get-char get-string-all
get-line lookahead-char)
get-string-all (define-public (unget-char port char)
lookahead-char) (unread-char char port)))
(export unget-char)) (begin
(else (use-modules (ice-9 textual-ports))
(use-modules (ice-9 textual-ports)) (re-export get-char
(re-export get-char get-line
get-line get-string-all
get-string-all lookahead-char
lookahead-char unget-char)))
unget-char)))