X-Loop: help-debbugs@HIDDEN
Subject: bug#30094: [wishlist] better support for alternative languages
Resent-From: Ricardo Wurmus <rekado@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Fri, 12 Jan 2018 22:47:02 +0000
Resent-Message-ID: <handler.30094.B.151579718925050 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 30094
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: 30094 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-guile@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.151579718925050
(code B ref -1); Fri, 12 Jan 2018 22:47:02 +0000
Received: (at submit) by debbugs.gnu.org; 12 Jan 2018 22:46:29 +0000
Received: from localhost ([127.0.0.1]:54273 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ea85i-0006Vv-Lp
for submit <at> debbugs.gnu.org; Fri, 12 Jan 2018 17:46:29 -0500
Received: from eggs.gnu.org ([208.118.235.92]:42692)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <rekado@HIDDEN>) id 1ea85h-0006Vj-BA
for submit <at> debbugs.gnu.org; Fri, 12 Jan 2018 17:46:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <rekado@HIDDEN>) id 1ea85b-0006Yj-6c
for submit <at> debbugs.gnu.org; Fri, 12 Jan 2018 17:46:20 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID
autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:51265)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
(Exim 4.71) (envelope-from <rekado@HIDDEN>) id 1ea85b-0006Yd-3H
for submit <at> debbugs.gnu.org; Fri, 12 Jan 2018 17:46:19 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33650)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <rekado@HIDDEN>) id 1ea85Y-0003QZ-0A
for bug-guile@HIDDEN; Fri, 12 Jan 2018 17:46:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <rekado@HIDDEN>) id 1ea85T-0006UM-5F
for bug-guile@HIDDEN; Fri, 12 Jan 2018 17:46:16 -0500
Received: from sender-of-o51.zoho.com ([135.84.80.216]:21075)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
(Exim 4.71) (envelope-from <rekado@HIDDEN>) id 1ea85S-0006QT-SC
for bug-guile@HIDDEN; Fri, 12 Jan 2018 17:46:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1515797139;
s=zoho; d=elephly.net; i=rekado@HIDDEN;
h=From:To:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID;
l=713; bh=oD7I1fgtOeCQnh66vrko7A56biXRFBJUmzlIxuwA2VM=;
b=jISRXpXYJTS1CTydrMysq0BJs7ZizTdRzWrHet8u+bB0wrAF1NceEy1yBCWRkusF
v4tTwyP/aixpdCgXksUVZKM/edi8vULRGy+0aHxrSXkJVO3d7ineN521RcCetWn7S4j
8dN6ij3nDmnEmsPmoEZS6wst4YvXuAlvEipXoU+M=
Received: from localhost (port-92-200-78-238.dynamic.qsc.de [92.200.78.238])
by mx.zohomail.com with SMTPS id 1515797139691147.00674165935936;
Fri, 12 Jan 2018 14:45:39 -0800 (PST)
User-agent: mu4e 1.0-alpha3; emacs 25.3.1
From: Ricardo Wurmus <rekado@HIDDEN>
X-URL: https://elephly.net
X-PGP-Key: https://elephly.net/rekado.pubkey
X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
Date: Fri, 12 Jan 2018 23:45:36 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Message-ID: <876086wvan.fsf@HIDDEN>
X-ZohoMailClient: External
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
[fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)
Hi Guilers,
since Guile supports alternative language implementations like Wisp it
would be nice if it could interpret files that contain code written in
other languages, without having to specially cater to them.
If GUILE_LOAD_PATH contains a file =E2=80=9Cfoo.wisp=E2=80=9D written in Wi=
sp it would
be nice if Guile would automatically read it with the Wisp language.
The same applies to =E2=80=9Cload=E2=80=9D, which only supports Scheme code=
.
Another idea might be to adopt the =E2=80=9C#lang=E2=80=9D macro from Racke=
t to inform
Guile about the language that is used in the current file.
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Ricardo Wurmus <rekado@HIDDEN> Subject: bug#30094: Acknowledgement ([wishlist] better support for alternative languages) Message-ID: <handler.30094.B.151579718925050.ack <at> debbugs.gnu.org> References: <876086wvan.fsf@HIDDEN> X-Gnu-PR-Message: ack 30094 X-Gnu-PR-Package: guile Reply-To: 30094 <at> debbugs.gnu.org Date: Fri, 12 Jan 2018 22:47:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-guile@HIDDEN If you wish to submit further information on this problem, please send it to 30094 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 30094: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30094 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#30094: proposed code for alt languages
References: <876086wvan.fsf@HIDDEN>
In-Reply-To: <876086wvan.fsf@HIDDEN>
Resent-From: Matt Wette <matt.wette@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Sun, 19 Aug 2018 21:25:01 +0000
Resent-Message-ID: <handler.30094.B30094.153471388913041 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 30094
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: 30094 <at> debbugs.gnu.org
Cc: matt.wette@HIDDEN
Received: via spool by 30094-submit <at> debbugs.gnu.org id=B30094.153471388913041
(code B ref 30094); Sun, 19 Aug 2018 21:25:01 +0000
Received: (at 30094) by debbugs.gnu.org; 19 Aug 2018 21:24:49 +0000
Received: from localhost ([127.0.0.1]:54865 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1frVBo-0003OH-Vj
for submit <at> debbugs.gnu.org; Sun, 19 Aug 2018 17:24:49 -0400
Received: from mail-pl0-f51.google.com ([209.85.160.51]:46624)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <matt.wette@HIDDEN>) id 1frVBn-0003O5-FB
for 30094 <at> debbugs.gnu.org; Sun, 19 Aug 2018 17:24:47 -0400
Received: by mail-pl0-f51.google.com with SMTP id a4-v6so2578859plm.13
for <30094 <at> debbugs.gnu.org>; Sun, 19 Aug 2018 14:24:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=to:from:subject:cc:message-id:date:user-agent:mime-version
:content-language;
bh=tXii2OIyDZIOG0ZZyI+sO25g8+83wZXa9qb+JBKgOUA=;
b=Y0thArIHvLaPhWNR7jaLUeOTa4s8jX32MfsXyF5cmOd4tGBqNNDUmEgCVKSqMtWi0J
Nrw/S6Kp+6aBCVTTkB7mjeth0G994wDNHLnHwcet/xpXJpb2OG9RyuCKl7/F9h180zXT
jTPHhPkvE1Sj13VpBBRz9Nd0+Uf9Ew4VBHIuxiLLRk8FycElz4CuaomliC1mw98ORUCf
/dZiVW0XL3EbOqO9fgpRKY5ISkJUbKAZoqtX3+zJ9p9kiYA3izOOciQOPWIflK2nu6EZ
I1pbf8du3QkMkhDgF7Fte3APmYkXLCMy1aVZ06tlFifQjzCsudofav+XBX0UICaRNaao
k0dg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:to:from:subject:cc:message-id:date:user-agent
:mime-version:content-language;
bh=tXii2OIyDZIOG0ZZyI+sO25g8+83wZXa9qb+JBKgOUA=;
b=HB+/d1+RPAcwoNGdNT5VSyOedzPXeqdpkdF2btor35lqx+tZFnV+qSmPlOnNL6s4+V
B23Xu1amzA7I/3/l8o2bmuoUkvzuoo08xaHNgtuk23zhArWxQY5AZleCmqfuwFqIXbW7
z4KQ06WizdxgBP8Pf4ImxG0+PDPYmKqL6kQHcVFeVbPT2dbg6c/wZnOMXt9DWIfp0rPm
xYnCyRmyVmpD15MOLQKa0u+CK02aPXK69/MbnOhccCPS6H+umvCX1bMIeE+8U+IcAAZq
IJYyBzg+wAUh9fofLqB+YXlRUZw9/4bk24tBZF2gYje1Y/0D6pYRYSUOUa4v9E56Dfxw
iLxQ==
X-Gm-Message-State: AOUpUlFoV7jVQ582LAdRLQLHDkdfYSK+uz/3oApzbtCa/ZYmAF5yKNCi
xqxGOGkRq5xci0UymbEyX4M=
X-Google-Smtp-Source: AA+uWPxIGD9yDTuc1AYI8ROWjyhc6nHWZX1y6HcdcKuTZdN8ciP/zFNfsPZ6aBMklxGRBqdSOrRmbA==
X-Received: by 2002:a17:902:8b86:: with SMTP id
ay6-v6mr42285653plb.25.1534713881409;
Sun, 19 Aug 2018 14:24:41 -0700 (PDT)
Received: from [192.168.2.183] (216-165-229-229.championbroadband.com.
[216.165.229.229])
by smtp.gmail.com with ESMTPSA id a17-v6sm12821549pfg.106.2018.08.19.14.24.40
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Sun, 19 Aug 2018 14:24:40 -0700 (PDT)
From: Matt Wette <matt.wette@HIDDEN>
Message-ID: <acbfb695-70ac-9699-2e35-8b17389d6ae8@HIDDEN>
Date: Sun, 19 Aug 2018 14:24:40 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------9BEE22966A3B393C65FD3FB6"
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
This is a multi-part message in MIME format.
--------------9BEE22966A3B393C65FD3FB6
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Hey all,
The attached code implements alternative languages. It is roughly a patch to
(system base compile). It provides
1) extra procedures lang-from-port and lang-from-file
2) the global %file-extension-map
3) an altered version of compile-file
Behavior:
1) if the first line of the file is `#lang <lang>' then that is used as from
2) if the file-ending matches an entry in the a-list %file-extension-map the ref is used
Matt
In the following, compile.scm and ncompile.scm are trimmed to only contain
the procedure compile-file
mwette$ diff -c compile.scm ncompile.scm
*** compile.scm Sun Aug 19 14:19:44 2018
--- ncompile.scm Sun Aug 19 14:20:07 2018
***************
*** 1,10 ****
! (define* (compile-file file #:key
! (output-file #f)
! (from (current-language))
! (to 'bytecode)
! (env (default-environment from))
! (opts '())
! (canonicalization 'relative))
(with-fluids ((%file-port-name-canonicalization canonicalization))
(let* ((comp (or output-file (compiled-file-name file)
(error "failed to create path for auto-compiled file"
--- 1,10 ----
! (define* (ncompile-file file #:key
! (output-file #f)
! (from #f)
! (to 'bytecode)
! (env #f)
! (opts '())
! (canonicalization 'relative))
(with-fluids ((%file-port-name-canonicalization canonicalization))
(let* ((comp (or output-file (compiled-file-name file)
(error "failed to create path for auto-compiled file"
***************
*** 16,25 ****
(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)))
Here is ncompile:;; ncompile v180819b
;; usage:
;; (ncompile-file "foo.m")
;; first checks for first line of the form
;; #lang <from-language>
;; then uses file ending ".m" => nx-matlab
(define-module (ncompile)
#:export (ncompile-file)
)
(define (lang-from-port port)
(define (release chl)
(let loop ((chl chl))
(unless (null? chl)
(unread-char (car chl) port)
(loop (cdr chl))))
#f)
(define (return chl)
(string->symbol (reverse-list->string chl)))
(let loop ((cl '()) (st 0) (kl '(#\# #\l #\a #\n #\g)) (ch (read-char port)))
(case st
((0) (cond ; read `#lang'
((eof-object? ch) (release cl))
((null? kl) (loop cl 1 kl ch))
((char=? ch (car kl))
(loop (cons ch cl) st (cdr kl) (read-char port)))
(else (release (cons ch cl)))))
((1) (cond ; skip spaces
((eof-object? ch) (release cl))
((char=? ch #\space) (loop (cons ch cl) st kl (read-char port)))
(else (loop cl 2 '() ch))))
((2) (cond ; collect lang name
((eof-object? ch) (return kl))
((char=? ch #\newline) (return kl))
((char-whitespace? ch) (loop cl 3 kl ch))
(else (loop cl st (cons ch kl) (read-char port)))))
((3) (cond
((eof-object? ch) (return kl))
((char=? ch #\newline) (return kl))
(else (loop cl st kl (read-char port))))))))
(define %file-extension-map
'(("scm" . scheme)
("el" . elisp)
("m" . nx-matlab)
("js" . ecmascript)))
(define* (lang-from-file file)
(let* ((ix (string-rindex file #\.))
(ext (and ix (substring file (1+ ix)))))
(and ext (assoc-ref %file-extension-map ext))))
(define call-with-output-file/atomic
(@@ (system base compile) call-with-output-file/atomic))
(define language-printer
(@ (system base language) language-printer))
(define ensure-language
(@@ (system base compile) ensure-language))
(define ensure-directory
(@@ (system base compile) ensure-directory))
(define read-and-compile
(@@ (system base compile) read-and-compile))
(define compiled-file-name
(@@ (system base compile) compiled-file-name))
(define default-environment
(@@ (system base compile) default-environment))
(define* (ncompile-file file #:key
(output-file #f)
(from #f)
(to 'bytecode)
(env #f)
(opts '())
(canonicalization 'relative))
(with-fluids ((%file-port-name-canonicalization canonicalization))
(let* ((comp (or output-file (compiled-file-name file)
(error "failed to create path for auto-compiled file"
file)))
(in (open-input-file file))
(enc (file-encoding in)))
;; Choose the input encoding deterministically.
(set-port-encoding! in (or enc "UTF-8"))
(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)))
;; Local Variables:
;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1)
;; End:
;; --- last line ---
--------------9BEE22966A3B393C65FD3FB6
Content-Type: text/x-scheme;
name="ncompile.scm"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="ncompile.scm"
;; ncompile v180819b
;; usage:
;; (ncompile-file "foo.m")
;; first checks for first line of the form
;; #lang <from-language>
;; then uses file ending ".m" => nx-matlab
(define-module (ncompile)
#:export (ncompile-file)
)
(define (lang-from-port port)
(define (release chl)
(let loop ((chl chl))
(unless (null? chl)
(unread-char (car chl) port)
(loop (cdr chl))))
#f)
(define (return chl)
(string->symbol (reverse-list->string chl)))
(let loop ((cl '()) (st 0) (kl '(#\# #\l #\a #\n #\g)) (ch (read-char port)))
(case st
((0) (cond ; read `#lang'
((eof-object? ch) (release cl))
((null? kl) (loop cl 1 kl ch))
((char=? ch (car kl))
(loop (cons ch cl) st (cdr kl) (read-char port)))
(else (release (cons ch cl)))))
((1) (cond ; skip spaces
((eof-object? ch) (release cl))
((char=? ch #\space) (loop (cons ch cl) st kl (read-char port)))
(else (loop cl 2 '() ch))))
((2) (cond ; collect lang name
((eof-object? ch) (return kl))
((char=? ch #\newline) (return kl))
((char-whitespace? ch) (loop cl 3 kl ch))
(else (loop cl st (cons ch kl) (read-char port)))))
((3) (cond
((eof-object? ch) (return kl))
((char=? ch #\newline) (return kl))
(else (loop cl st kl (read-char port))))))))
(define %file-extension-map
'(("scm" . scheme)
("el" . elisp)
("m" . nx-matlab)
("js" . ecmascript)))
(define* (lang-from-file file)
(let* ((ix (string-rindex file #\.))
(ext (and ix (substring file (1+ ix)))))
(and ext (assoc-ref %file-extension-map ext))))
(define call-with-output-file/atomic
(@@ (system base compile) call-with-output-file/atomic))
(define language-printer
(@ (system base language) language-printer))
(define ensure-language
(@@ (system base compile) ensure-language))
(define ensure-directory
(@@ (system base compile) ensure-directory))
(define read-and-compile
(@@ (system base compile) read-and-compile))
(define compiled-file-name
(@@ (system base compile) compiled-file-name))
(define default-environment
(@@ (system base compile) default-environment))
(define* (ncompile-file file #:key
(output-file #f)
(from #f)
(to 'bytecode)
(env #f)
(opts '())
(canonicalization 'relative))
(with-fluids ((%file-port-name-canonicalization canonicalization))
(let* ((comp (or output-file (compiled-file-name file)
(error "failed to create path for auto-compiled file"
file)))
(in (open-input-file file))
(enc (file-encoding in)))
;; Choose the input encoding deterministically.
(set-port-encoding! in (or enc "UTF-8"))
(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)))
;; Local Variables:
;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1)
;; End:
;; --- last line ---
--------------9BEE22966A3B393C65FD3FB6--
X-Loop: help-debbugs@HIDDEN
Subject: bug#30094: patch for adding external lang support
References: <876086wvan.fsf@HIDDEN>
In-Reply-To: <876086wvan.fsf@HIDDEN>
Resent-From: Matt Wette <matt.wette@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Tue, 04 Sep 2018 13:44:01 +0000
Resent-Message-ID: <handler.30094.B30094.153606862927720 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 30094
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: 30094 <at> debbugs.gnu.org
Received: via spool by 30094-submit <at> debbugs.gnu.org id=B30094.153606862927720
(code B ref 30094); Tue, 04 Sep 2018 13:44:01 +0000
Received: (at 30094) by debbugs.gnu.org; 4 Sep 2018 13:43:49 +0000
Received: from localhost ([127.0.0.1]:45190 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1fxBcT-0007D2-1n
for submit <at> debbugs.gnu.org; Tue, 04 Sep 2018 09:43:49 -0400
Received: from mail-pf1-f169.google.com ([209.85.210.169]:41561)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <matt.wette@HIDDEN>) id 1fxBcQ-0007Ck-Tk
for 30094 <at> debbugs.gnu.org; Tue, 04 Sep 2018 09:43:47 -0400
Received: by mail-pf1-f169.google.com with SMTP id h79-v6so1719220pfk.8
for <30094 <at> debbugs.gnu.org>; Tue, 04 Sep 2018 06:43:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=to:from:subject:message-id:date:user-agent:mime-version
:content-transfer-encoding:content-language;
bh=RSrWGS77gNAke35vwY1Osh7/JftPc/FDiXAzJu83OEI=;
b=DMs2JRKW1U3434kYHFZb9SH9b7XZiz7cBCiv1IIgYnaTJkMgl3JKOAJYtpuvVRBCzX
wkVAjZZxLWghiIPt0sES05mJ9OK3aO4EEPnP1REiCRXPD7EOmbLnyzX64vDa8myV4RVp
WnXFUZCGpIMYUDNd7baw3YGXdylusgjNJWmR4vw9tTgUFrJkdBAvZUtvvUuH+Xwezo0s
0GLpNZC30xgUCjmyJswuUG9tTL+nWCwAJQPYnJim75OTos2Iz6+bsz8RM8vKgqdWmytQ
W+k0ANhaztPPkm3go1ZBjBZOgzq8Ov+956pYdyYiqyg9ZvtKXbdpOoyCaXPN+vv6QVQg
NO1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:to:from:subject:message-id:date:user-agent
:mime-version:content-transfer-encoding:content-language;
bh=RSrWGS77gNAke35vwY1Osh7/JftPc/FDiXAzJu83OEI=;
b=pfjwh9sdbGlKcPTku9UU1g1qhZQWssapgmej5EibBMWyM2Ela61GKydbOQ3Jo91ArE
DqtMHv07ft/DGhjVGTEyJUQFGeuslJyJBTQrICUk9OsuKDjjrYUVOfPJh8ynDqRA7INS
U8FfY9sFD+BsS8Lh2bU1qv60IITaL1yVhq6Kks4gK8bQHItRuOfVaRsgKjFrU3LRaFWc
jWRpa2Zqd854Pz/zhgDRUWcO9Rg9n9VuhT3eFQhNcyJXWAa/+Bn2F8xH6YNDMYJzIrek
6bx1MYI0ZD9NHCffQRQ197uG9YIhbOctzxWSa5LVHvGeq1dUVKRXKmbtXwlg9ZwZ7g2O
DffQ==
X-Gm-Message-State: APzg51Dh6Uf37pMAX57R0WP0lWPIHd872Aga9PFNeizslr0tl6QFulST
AnE2z24Y+ZBuMcMbxbLZk8MqLBMq
X-Google-Smtp-Source: ANB0VdaWZgj6AdMpt1TeKkZ7LCsMKV0cNp522bQTgDwzgkQCRe7Xu2BVxSBezqEFlTk3Xre66fBf/w==
X-Received: by 2002:a63:5fc8:: with SMTP id
t191-v6mr31422456pgb.183.1536068620484;
Tue, 04 Sep 2018 06:43:40 -0700 (PDT)
Received: from [192.168.2.183] (216-165-229-229.championbroadband.com.
[216.165.229.229])
by smtp.gmail.com with ESMTPSA id l84-v6sm51823989pfg.3.2018.09.04.06.43.39
for <30094 <at> debbugs.gnu.org>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Tue, 04 Sep 2018 06:43:40 -0700 (PDT)
From: Matt Wette <matt.wette@HIDDEN>
Message-ID: <8cd59533-5fdb-7ae0-f37b-bc9117044161@HIDDEN>
Date: Tue, 4 Sep 2018 06:43:39 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Here is a patch against 2.2.4. It compiled and passed "make check".
Still to go: some test-suite scripts.
--- module/system/base/compile.scm-orig 2016-08-01 04:32:31.000000000 -0700
+++ module/system/base/compile.scm 2018-09-04 06:27:53.056330281 -0700
@@ -28,6 +28,7 @@
#:use-module (ice-9 receive)
#:export (compiled-file-name
compile-file
+ add-extension
compile-and-load
read-and-compile
compile
@@ -132,11 +133,65 @@
(and (false-if-exception (ensure-directory (dirname f)))
f))))
+;; --- new ---------------------------
+
+(define (lang-from-port port)
+
+ (define (release chl)
+ (let loop ((chl chl))
+ (unless (null? chl)
+ (unread-char (car chl) port)
+ (loop (cdr chl))))
+ #f)
+
+ (define (return chl)
+ (string->symbol (reverse-list->string chl)))
+
+ (let loop ((cl '()) (st 0) (kl '(#\# #\l #\a #\n #\g)) (ch (read-char port)))
+ (case st
+ ((0) (cond ; read `#lang'
+ ((eof-object? ch) (release cl))
+ ((null? kl) (loop cl 1 kl ch))
+ ((char=? ch (car kl))
+ (loop (cons ch cl) st (cdr kl) (read-char port)))
+ (else (release (cons ch cl)))))
+ ((1) (cond ; skip spaces
+ ((eof-object? ch) (release cl))
+ ((char=? ch #\space) (loop (cons ch cl) st kl (read-char port)))
+ (else (loop cl 2 '() ch))))
+ ((2) (cond ; collect lang name
+ ((eof-object? ch) (return kl))
+ ((char=? ch #\newline) (return kl))
+ ((char-whitespace? ch) (loop cl 3 kl ch))
+ (else (loop cl st (cons ch kl) (read-char port)))))
+ ((3) (cond
+ ((eof-object? ch) (return kl))
+ ((char=? ch #\newline) (return kl))
+ (else (loop cl st kl (read-char port))))))))
+
+(define %file-extension-map
+ '(("scm" . scheme)
+ ("el" . elisp)
+ ("js" . ecmascript)))
+
+(define (add-extension tag lang)
+ (unless (and (string? tag) (symbol? lang))
+ (error "expecting string symbol"))
+ (set! %file-extension-map (acons tag lang %file-extension-map)))
+
+(define* (lang-from-file file)
+ (let* ((ix (string-rindex file #\.))
+ (ext (and ix (substring file (1+ ix)))))
+ (and ext (assoc-ref %file-extension-map ext))))
+
+
+;; -----------------------------------
+
(define* (compile-file file #:key
(output-file #f)
- (from (current-language))
+ (from #f)
(to 'bytecode)
- (env (default-environment from))
+ (env #f)
(opts '())
(canonicalization 'relative))
(with-fluids ((%file-port-name-canonicalization canonicalization))
@@ -151,11 +206,17 @@
(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)
+ (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)))
(define* (compile-and-load file #:key (from (current-language)) (to 'value)
X-Loop: help-debbugs@HIDDEN
Subject: bug#30094: patch for adding external lang support
Resent-From: Matt Wette <matt.wette@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Tue, 04 Sep 2018 14:01:01 +0000
Resent-Message-ID: <handler.30094.B30094.153606965829907 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 30094
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: 30094 <at> debbugs.gnu.org
Received: via spool by 30094-submit <at> debbugs.gnu.org id=B30094.153606965829907
(code B ref 30094); Tue, 04 Sep 2018 14:01:01 +0000
Received: (at 30094) by debbugs.gnu.org; 4 Sep 2018 14:00:58 +0000
Received: from localhost ([127.0.0.1]:45891 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1fxBt3-0007mJ-SI
for submit <at> debbugs.gnu.org; Tue, 04 Sep 2018 10:00:58 -0400
Received: from mail-pf1-f173.google.com ([209.85.210.173]:36637)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <matt.wette@HIDDEN>) id 1fxBt1-0007m6-8A
for 30094 <at> debbugs.gnu.org; Tue, 04 Sep 2018 10:00:55 -0400
Received: by mail-pf1-f173.google.com with SMTP id b11-v6so1755791pfo.3
for <30094 <at> debbugs.gnu.org>; Tue, 04 Sep 2018 07:00:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=subject:from:to:references:message-id:date:user-agent:mime-version
:in-reply-to:content-transfer-encoding:content-language;
bh=LPUxPuUIXHUcSV9n1I+46nErsPikAEKBahGJVUI6wsA=;
b=tda9kxg5zbM+0oXvNpaygvribvg7Up9fymAQd6Z827UmRvEWXzh+ajEmBAg3wwp992
m06FmQFl1xZQVg+GCo8mEkyawGzgVakyr/aHTFcWbyeZrV/Lb2+VY7x0IXEb+JkuGVBo
oedF/FFofGIgZsOxWeNmrG75B8ZjPHDalv1ZgL9qV3hddSts6Ae8itV8eqLME4jfTPQj
Al1PSN+ztPi6Vx5ZuhO+oMnWGG6SHJNmiaSscF0MZs9xMB6hMkG8dLxwSaqpztn1rJpj
eJgSrMKRb2hYmpNTr5akV5lUEA5ohSt8h9yVzxpj4DGpsv9Br8PFIipOlp9v17hswz67
qN9w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:subject:from:to:references:message-id:date
:user-agent:mime-version:in-reply-to:content-transfer-encoding
:content-language;
bh=LPUxPuUIXHUcSV9n1I+46nErsPikAEKBahGJVUI6wsA=;
b=MNMePqgr0KCGYM3q1EdsAli4Q9LMP4K8KGlWJ0WH4M4S9JP9z9QAfFXbwTcx8t4DTf
waA4Y400bL3s8zWdtaBl41hIp7Y0FTAnV4wqABRD/DFL+xV3ZFRPRlSjiy3g2LEIojkk
rPiJ9d75r2IxsZa9swY2MuAQ5qq4UYyyqMQidpvlQAWdayD2kbX/c6mpxoXClJWqxeFK
1FEyKggAVVxknFtVTxKfwgOIFdnWh2mUThaKfnZGZQNsLDo75Tmn0R4S6InsRcE4o45C
4O8aulRD1xCgHaEBSYxL0GNTYy6dmv+dysvkYfnhlJ0TF8Q3yBPAd70Lig7X8SBOJ+CD
HrzA==
X-Gm-Message-State: APzg51Aa2Zi83/QwSd+rL5pZLzgv0V3svpL5+Yq4xWFrBWtBa5aBafvO
hGvc4LbaKXYqGqhrbFKB4HtwI0cr
X-Google-Smtp-Source: ANB0VdZD4JXo4kpYinJgshMVqpszyF4WvU7WLEbvWrXDpeOJY1NqbczBYDrwetJ0LhsARc0GrvU32Q==
X-Received: by 2002:a62:3703:: with SMTP id
e3-v6mr34723219pfa.117.1536069648344;
Tue, 04 Sep 2018 07:00:48 -0700 (PDT)
Received: from [192.168.2.183] (216-165-229-229.championbroadband.com.
[216.165.229.229])
by smtp.gmail.com with ESMTPSA id j22-v6sm28531014pfh.45.2018.09.04.07.00.47
for <30094 <at> debbugs.gnu.org>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Tue, 04 Sep 2018 07:00:47 -0700 (PDT)
From: Matt Wette <matt.wette@HIDDEN>
References: <8cd59533-5fdb-7ae0-f37b-bc9117044161@HIDDEN>
Message-ID: <22079c48-08cc-77c0-0397-752acbcc738e@HIDDEN>
Date: Tue, 4 Sep 2018 07:00:46 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <8cd59533-5fdb-7ae0-f37b-bc9117044161@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
There is a left-over simple-format statement which should be removed.
X-Loop: help-debbugs@HIDDEN
Subject: bug#30094: test script
References: <876086wvan.fsf@HIDDEN>
In-Reply-To: <876086wvan.fsf@HIDDEN>
Resent-From: Matt Wette <matt.wette@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Wed, 05 Sep 2018 01:36:01 +0000
Resent-Message-ID: <handler.30094.B30094.153611133222334 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 30094
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: 30094 <at> debbugs.gnu.org
Received: via spool by 30094-submit <at> debbugs.gnu.org id=B30094.153611133222334
(code B ref 30094); Wed, 05 Sep 2018 01:36:01 +0000
Received: (at 30094) by debbugs.gnu.org; 5 Sep 2018 01:35:32 +0000
Received: from localhost ([127.0.0.1]:46180 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1fxMjE-0005oA-Ei
for submit <at> debbugs.gnu.org; Tue, 04 Sep 2018 21:35:32 -0400
Received: from mail-pg1-f170.google.com ([209.85.215.170]:36751)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <matt.wette@HIDDEN>) id 1fxMjB-0005nw-TV
for 30094 <at> debbugs.gnu.org; Tue, 04 Sep 2018 21:35:30 -0400
Received: by mail-pg1-f170.google.com with SMTP id d1-v6so2559454pgo.3
for <30094 <at> debbugs.gnu.org>; Tue, 04 Sep 2018 18:35:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=from:subject:to:message-id:date:user-agent:mime-version
:content-transfer-encoding:content-language;
bh=+zQglOxhdjZah7U2gh1Fm0idIVHbk76fzxFaWAQ5yzM=;
b=TwssboCukGbvx5sfP9uxJ4i9whZjg18m2wSu5TejqKYg7bp+eVCDW8py3fsSC+/TBd
avA2GCusYAHKGyvrY2qOg5bkeyDuRzXpeuqdOl1JWLFINg4IyDi5mTVtXnQRZ14js+mZ
718bnygUIEdlRABwlqtnY3QhqvozIseZnkErLqDjtaxVdS12MyN0qQUOpHDVmRZvmzZn
LuC3Umdc/UZTAh28mRYIApXNuXMwyicjyo6hRbuZKLDZSpeDYCKHPazckYuyMTKuUG2b
mDJ9P6c3MRJraVaRYC0l+pXWmhAw9rpMfF4j4HyOVVCo+8bWTNUNtwkM4YeSYs7UVztB
t0jg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:subject:to:message-id:date:user-agent
:mime-version:content-transfer-encoding:content-language;
bh=+zQglOxhdjZah7U2gh1Fm0idIVHbk76fzxFaWAQ5yzM=;
b=iBLI9mkYr1SSS3xRlYkaW2smZ9vzz+YXSsaxBj/355Pew0EsxUERZ7W+L1OFPAFGu4
6VSVb5dp4tkQgVtRet1RbqO//HB4FvvUgBadiQk+Vg/xY41jPcey3RyQuo3ThmY3Dxft
ZILXRa+kKbYHBCRVAEq6rcisCyEG5x5k9y63aJwUSPMkOQQBaKNYLQhWQZE8Q2hOVb8P
SfhbKW7HFwRngzLjdZC4q95fkvf7WHM3uGU23rXyo4rqmB4IPk9qLrx//tc/Lyx3e5Hq
6AG8MdzRaru4cJ5x8DqciH3F7hbI7/2Q+8WQTB4LXV25Q37u8m3ZJwwGmOLdLVV7Cqzf
DrDg==
X-Gm-Message-State: APzg51COH7WaXx/GvkqHA657D697CpFHinPH3myQkGiZVy6h+MmBCxT3
ksX0teYjrlJTb68TY3m3iHFYDT4V
X-Google-Smtp-Source: ANB0VdZyi0HLOqkokO4lGbgDgsP2bIqkaMM2ZcXQbrjdHcbxiYXVaIljiUjbqDehJ06NlDXKayG9Vw==
X-Received: by 2002:a63:d857:: with SMTP id
k23-v6mr34082309pgj.106.1536111323621;
Tue, 04 Sep 2018 18:35:23 -0700 (PDT)
Received: from [192.168.2.183] (216-165-229-229.championbroadband.com.
[216.165.229.229])
by smtp.gmail.com with ESMTPSA id f4-v6sm417876pfj.46.2018.09.04.18.35.22
for <30094 <at> debbugs.gnu.org>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Tue, 04 Sep 2018 18:35:23 -0700 (PDT)
From: Matt Wette <matt.wette@HIDDEN>
Message-ID: <e750030e-2144-a3d3-2d70-16936f58dc35@HIDDEN>
Date: Tue, 4 Sep 2018 18:35:21 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
The following test script works with the 2.2.4 patch provided.
elisp tests don't work well but I think that is elisp issue.
This stuff works with my own developed.
;;; load-lang.test - -*- scheme -*-
(define-module (test-suite test-load-lang)
#:use-module (test-suite lib))
(define tmp-dir (getcwd))
(define (data-file-name filename)
(in-vicinity tmp-dir filename))
(with-test-prefix "load/lang"
(pass-if "using #lang"
(let ((src-file (data-file-name "load1js")))
(with-output-to-file src-file
(lambda ()
(display "#lang ecmascript\n")
(display "function js_1pl(b) { return 1 + b; }\n")))
(load src-file)
(delete-file src-file)
(= (js_1pl 2) 3)))
(pass-if "using dot-js"
(let ((src-file (data-file-name "load2.js")))
(with-output-to-file src-file
(lambda ()
(display "function js_2pl(b) { return 2 + b; }\n")))
(load src-file)
(delete-file src-file)
(= (js_2pl 2) 4)))
)
;; --- last line ---
X-Loop: help-debbugs@HIDDEN
Subject: bug#30094: load-lang patch
References: <876086wvan.fsf@HIDDEN>
In-Reply-To: <876086wvan.fsf@HIDDEN>
Resent-From: Matt Wette <matt.wette@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Sun, 23 Sep 2018 17:30:01 +0000
Resent-Message-ID: <handler.30094.B30094.153772375028922 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 30094
X-GNU-PR-Package: guile
X-GNU-PR-Keywords:
To: 30094 <at> debbugs.gnu.org
Received: via spool by 30094-submit <at> debbugs.gnu.org id=B30094.153772375028922
(code B ref 30094); Sun, 23 Sep 2018 17:30:01 +0000
Received: (at 30094) by debbugs.gnu.org; 23 Sep 2018 17:29:10 +0000
Received: from localhost ([127.0.0.1]:51052 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1g48By-0007WQ-4H
for submit <at> debbugs.gnu.org; Sun, 23 Sep 2018 13:29:10 -0400
Received: from mail-pf1-f180.google.com ([209.85.210.180]:40974)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <matt.wette@HIDDEN>) id 1g48Bw-0007WC-Lw
for 30094 <at> debbugs.gnu.org; Sun, 23 Sep 2018 13:29:09 -0400
Received: by mail-pf1-f180.google.com with SMTP id h79-v6so8052964pfk.8
for <30094 <at> debbugs.gnu.org>; Sun, 23 Sep 2018 10:29:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=to:from:subject:message-id:date:user-agent:mime-version
:content-transfer-encoding:content-language;
bh=RdIW0LjkUW/CKP7Hl+1c9funA+X6fVZ59WANbhcMBKA=;
b=KLZxlM4WYyEvvn9RBdy3INyYoheKvufKR5inz8v8Ww0K7M4PPoL9059mjupChZyrfV
3m+33gDYti+MQU8o1DT7Z9uN38VNLh8vh2Y+S2JL5yay4c//FkIDfQjZDeAIrvhHhHg5
Yc7NTzFb0JyNpuiYW7SH0FMRdNZOSYCrOqPKuB1Olj6x1lnTFhD7/wl064/NXpixIk08
ixT1PjOCw85KT/911PujgyZzYmCT0w5Fwu6PSUKcdpp5ofUZOTWcLbWrtmY+VWbumFKV
GQChvSFsjFkdU/uV7WDTykYDzSvK+xeqy0W/fDib0nljsMCq0KtLrpcAlUagH9QXYK2+
RaDA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:to:from:subject:message-id:date:user-agent
:mime-version:content-transfer-encoding:content-language;
bh=RdIW0LjkUW/CKP7Hl+1c9funA+X6fVZ59WANbhcMBKA=;
b=p/x/RCiCIs2mrW0p8CtpKVFNgxbWarDIlizzI3Hj3bMm5PAVhqxW/uKcKUKehop59m
GXW651dSTm/YxQS+OdXn4+/ajcuI3o8QVD+WbMOPukOx6v4P3iG0v9ll3pkV9X5Qj77N
Rch+lB0+knVAv/G/2wkWIs2HBPjCzzQ4I0X3S7tTluapmp0FDMDX8e+RmrPTsDCwcrxg
qm0c3JPO1JtX0fBEBfeL2J3aq7fnj8h+lqo9EqkfAJQPU0UiN0WWGNFpM7tFRmGxMlkA
QVzii2xWRp9hbmIpxgr3je9kxMBTYfIIGIpV9X0HgM04CX4TIRrPPLxkiBV4NHQabqgy
X3xg==
X-Gm-Message-State: ABuFfojDHylh4mFKgm2tJiZEK7+Wv4KxKlzvu1n9fQx6fGz7t1XB91Xw
Vnx+O34FhKfZrxl9CGPUOmMQG6ov
X-Google-Smtp-Source: ACcGV61QdxYwYl8vjy7pyOleJE67b3+RIjmZbpolj0XHrR8krL+Xmh1fHuWadBQhskD5Lz5LlbFbDg==
X-Received: by 2002:a63:ca09:: with SMTP id
n9-v6mr6492578pgi.287.1537723742398;
Sun, 23 Sep 2018 10:29:02 -0700 (PDT)
Received: from [192.168.2.183] (216-165-229-229.championbroadband.com.
[216.165.229.229])
by smtp.gmail.com with ESMTPSA id p19-v6sm57079536pgh.60.2018.09.23.10.29.01
for <30094 <at> debbugs.gnu.org>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Sun, 23 Sep 2018 10:29:02 -0700 (PDT)
From: Matt Wette <matt.wette@HIDDEN>
Message-ID: <bcd33623-9dc4-4534-338b-052dc6be3e62@HIDDEN>
Date: Sun, 23 Sep 2018 10:29:01 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
I am now posting patch for this to github.com mwette guile-contrib
patch-2.2.4 load.patch .
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.