From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.devel Subject: [PATCH v7 05/16] (scheme base): Support non-negative SRFI integer names in cond-expand. Date: Mon, 4 Dec 2023 16:45:10 -0500 Message-ID: <20231204215143.3146-6-maxim.cournoyer@gmail.com> References: <20231204215143.3146-1-maxim.cournoyer@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="860"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Maxim Cournoyer To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Dec 04 22:52:49 2023 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rAGrw-000AX5-Mx for guile-devel@m.gmane-mx.org; Mon, 04 Dec 2023 22:52:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rAGrD-0000CV-1y; Mon, 04 Dec 2023 16:52:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rAGrB-0000Ba-QB for guile-devel@gnu.org; Mon, 04 Dec 2023 16:52:01 -0500 Original-Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rAGrA-0007pc-31 for guile-devel@gnu.org; Mon, 04 Dec 2023 16:52:01 -0500 Original-Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6d9a3c035b3so822650a34.2 for ; Mon, 04 Dec 2023 13:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701726718; x=1702331518; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P3jqh6I+pJFA/xiJdF29eAmzvBm1Zw9Yr7wnSZEicSI=; b=gEmeE69BHGUqWqYfwcScjZXsQr+wwcH+isGleuX3COKJ6bKeiqrNZAzFZTWIAJY2Dq XOWZQW9H+FgE0c4MW90eL2RNgnqWwDRZEDi1nSjiXdoCndaaOE8xcVAzO5ruNnaYmY/J 2pgKHzS7+V6RLRWVhm5TEoCMzR6JIpLXyeQS+JpbUkBkHG0G439/thCR+jI7RGk1SuEm DxxcCXW8NN6EfYfH16J4GArnKXPRVXGJz/p66Nfk4fD7FeRlYCft7Pjksqc3SufWY/U5 iXmGf2CXky4avDzurtx8nY48z9sdCnYAc2Zt+xf7o7xYQcFn6EJV14COhXcRhDHUKiJw n0XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701726718; x=1702331518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P3jqh6I+pJFA/xiJdF29eAmzvBm1Zw9Yr7wnSZEicSI=; b=n/TTs9eGMrs0X0o0zCi63XZjwIX9+NG9K8htClbcvOHFU91QF9KUjfaNxr7hEkAYn1 MzXGVs2+/go8cttiK9KLDvk8Soqr2Mzljp6slgxdeVmMBwPxgO8wOijr2ac2MhYrcJlu pEa4cZmzkWKDh5ioYzs6olBhD+2FbMi+dNNVRqB+KsQc6C9K9CKAhvs94ORzpcu+cIVi ZQc8bKLyoyhrS8EtG7HHgK8Nr9ZkzlYQY2WtSm//CJ+bKG4ZOUK/hWudx5RPHU/sAzEF M6Tu11jv2/+1qznSH9aQ2+8/ieOU4B55squS7OPfZfPjyq0Ot1fxBlXzZsvkq+fX2SdP GMnw== X-Gm-Message-State: AOJu0YyDT1KChr/2H4qliJ+fyZaqahX8dv2/O4YmjOE3q7eDJ2wPzANL wQsbHG+9cDV+n/mfC7ScYZDlWWKJwzVF2g== X-Google-Smtp-Source: AGHT+IHTaQXWOd18zrpbWYNCwUdbe6a+h7dNxXIFRCaUob4kcdTM/DmUssUB9/cjPAzzFv2KTmR1sA== X-Received: by 2002:a9d:5f17:0:b0:6d8:74e2:a3dc with SMTP id f23-20020a9d5f17000000b006d874e2a3dcmr4785873oti.56.1701726718450; Mon, 04 Dec 2023 13:51:58 -0800 (PST) Original-Received: from localhost.localdomain (dsl-141-198.b2b2c.ca. [66.158.141.198]) by smtp.gmail.com with ESMTPSA id jd24-20020a05622a719800b00425438e7c5esm2642503qtb.62.2023.12.04.13.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 13:51:58 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231204215143.3146-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=maxim.cournoyer@gmail.com; helo=mail-ot1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22185 Archived-At: * module/scheme/base.scm (r7:cond-expand): Test for library using resolve-r6rs-interface instead of resolve-interface. Swallow any exception with false-if-exception. * test-suite/tests/r7rs-cond-expand.test: New test. * NEWS: Update news. --- (no changes since v5) Changes in v5: - Update NEWS NEWS | 1 + module/scheme/base.scm | 5 +++- test-suite/tests/r7rs-cond-expand.test | 35 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 test-suite/tests/r7rs-cond-expand.test diff --git a/NEWS b/NEWS index af66c80bd..1de1fa8b4 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,7 @@ other operations, given the internal use of those functions. () ** R7RS define-library now properly supports 'rename' declarations () +** (scheme base)'s cond-expand supports non-negative integer in modules names Changes in 3.0.9 (since 3.0.8) diff --git a/module/scheme/base.scm b/module/scheme/base.scm index 477dd9c28..2bd1f0d89 100644 --- a/module/scheme/base.scm +++ b/module/scheme/base.scm @@ -283,7 +283,10 @@ ((not req) (not (has-req? #'req))) ((library lib-name) - (->bool (resolve-interface (syntax->datum #'lib-name)))) + (->bool + (false-if-exception + (resolve-r6rs-interface + (syntax->datum #'lib-name))))) (id (identifier? #'id) (memq (syntax->datum #'id) (features))))) diff --git a/test-suite/tests/r7rs-cond-expand.test b/test-suite/tests/r7rs-cond-expand.test new file mode 100644 index 000000000..ea880d8c2 --- /dev/null +++ b/test-suite/tests/r7rs-cond-expand.test @@ -0,0 +1,35 @@ +;;; R7RS cond-expand -*- scheme -*- +;;; Copyright (C) 2023 Free Software Foundation, Inc. +;;; +;;; This library is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU Lesser General Public License as +;;; published by the Free Software Foundation, either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; This library 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 +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this program. If not, see +;;; . + +(define-module (test-suite r7rs-cond-expand) + #:use-module ((scheme base) #:select (cond-expand)) + #:use-module ((srfi srfi-64) #:select (test-read-eval-string)) + #:use-module (test-suite lib)) + +(pass-if "cond-expand expression missing library test" + (test-read-eval-string "\ +(cond-expand + ((library (srfi 99999 something)) + #f) + (else #t))")) + +(pass-if "cond-expand expression found library test" + (test-read-eval-string "\ +(cond-expand + ((library (srfi 64)) + #t) + (else #f))")) -- 2.41.0