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))))
#f)
(cond-expand
((and guile-2 (not guile-2.2))
(define* (setvbuf port mode #:optional size)
(let ((mode (match mode
('none _IONBF)
('line _IOLBF)
('block _IOFBF))))
((@ (guile) setvbuf) port mode size)))
(export! setvbuf))
(else #f))
(if-guile-version-below (2 2 0)
(begin
(define* (setvbuf port mode #:optional size)
(let ((mode (match mode
('none _IONBF)
('line _IOLBF)
('block _IOFBF))))
((@ (guile) setvbuf) port mode size)))
(export! setvbuf))
#f)

View File

@ -16,7 +16,8 @@
;;; 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 textual-ports))
(define-module (gash compat textual-ports)
#:use-module (gash compat))
;;; Commentary:
;;;
@ -25,20 +26,19 @@
;;;
;;; Code:
(cond-expand
((and guile-2 (not guile-2.2))
(use-modules (rnrs io ports))
(define (unget-char port char)
(unread-char char port))
(re-export get-char
get-line
get-string-all
lookahead-char)
(export unget-char))
(else
(use-modules (ice-9 textual-ports))
(re-export get-char
get-line
get-string-all
lookahead-char
unget-char)))
(if-guile-version-below (2 2 0)
(begin
(use-modules (rnrs io ports))
(re-export get-char
get-line
get-string-all
lookahead-char)
(define-public (unget-char port char)
(unread-char char port)))
(begin
(use-modules (ice-9 textual-ports))
(re-export get-char
get-line
get-string-all
lookahead-char
unget-char)))