guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

handling alternative languages in Guile


From: Matt Wette
Subject: handling alternative languages in Guile
Date: Sun, 19 Aug 2018 14:35:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi All,

Guile bug report 30094 is a wishlist request for adding support for alterantive 
languages.
To that bug report I attached proposed code for allowing -from being generated 
from
(1) #lang <lang> or (2) file extension.

The essential change is to compile-file in (system base compile):

        (ensure-directory (dirname comp))
        (call-with-output-file/atomic comp
!         (lambda (port)
!           ((language-printer (ensure-language to))
!            (read-and-compile in #:env env #:from from #:to to #:opts
!                              (cons* #:to-file? #t opts))
!            port))
!         file)
!       comp)))
--- 16,31 ----
        (ensure-directory (dirname comp))
        (call-with-output-file/atomic comp
!       (lambda (port)
!         (let* ((from (or from
!                          (lang-from-port in)
!                          (lang-from-file file)
!                          (current-language)))
!                (env (or env (default-environment from))))
!           (simple-format (current-error-port) "compiling from lang ~A\n" from)
!           ((language-printer (ensure-language to))
!            (read-and-compile in #:env env #:from from #:to to #:opts
!                              (cons* #:to-file? #t opts))
!            port)))
!         file)
!       comp)))

Matt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]