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 v6 05/16] (scheme base): Support non-negative SRFI integer names in cond-expand. Date: Sat, 2 Dec 2023 20:37:06 -0500 Message-ID: <20231203014115.26985-6-maxim.cournoyer@gmail.com> References: <20231203014115.26985-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="29232"; 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 Sun Dec 03 02:42:34 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 1r9bVA-0007Gl-RY for guile-devel@m.gmane-mx.org; Sun, 03 Dec 2023 02:42:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r9bUE-0001M9-2Z; Sat, 02 Dec 2023 20:41:34 -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 1r9bUC-0001LA-PJ for guile-devel@gnu.org; Sat, 02 Dec 2023 20:41:32 -0500 Original-Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r9bUA-0001Wu-TN for guile-devel@gnu.org; Sat, 02 Dec 2023 20:41:32 -0500 Original-Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b8b288eb76so714793b6e.3 for ; Sat, 02 Dec 2023 17:41:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701567689; x=1702172489; 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=MkqzTYFz79HNySB6iWHSteYz5MO2UydS6Tb2gPG3GPjT43gFmtAsjOFKwvUeKdoyJB WP+3sGXoezWyeggiUpHDDaC2eoNH1H+E08Z3oVaOc7s43TyzZbRLh2zC5QMrsZbHVe/7 JsN+j9hFHqnnrH/3orCDxcYWYd/188T0Ep1bWuKbn1tj/d8yVV4liROgHDE/c7f7EbVg 5JCce3p2txNNq0BczxTHue9iPwL0G8gY85QDRboVtYguTe47YYVQ9Jo9wU4hxvBmAzMm 8laEdLcICV1kmeJfVN39kjHx37fUN93mnrWGL/srzAyeYhDbc9c5E/Ud1cFIKRmmSPOh i/hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701567689; x=1702172489; 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=KQ5V20emKXvkRKs6HKsavDIr3eizF7W/sCnwTZ/l38iIpHftsOhdilM/T7mEDcG8qA gBA1ekZOqSz9H1p8nFQUY9JRhYgTsb9FE2hU673YpQLiaKJcgnAvUIzhsMqQJa86W2h3 egOSP/JFXcdM7eELF2MfptFVhtJLkvORkuZiT+Nzd2WHx/iyml+8ZbpF8dpjVaHLeDpT Z8qXG7Nj8v6btNlWwawT9pA+B09OtTQQiARsX1SnUXRgNRgbvaZMd4I4koGuHnDvC5s/ FY71/Cm1lCRYyhd3xjCZX4mBYKOI17s7ixlMucNxLq4RLYIuf2Xo6hTcaUs/l4bxVW9C sJJg== X-Gm-Message-State: AOJu0YxFQpomxAPCOfqteZ5cKbzVefd8gVzM62786Lh5nylthIT2tNFn AGkZfjzHujUM4BDh8U7pLnaUMtj9hXo= X-Google-Smtp-Source: AGHT+IFJBmOaHDYQf0CL78U45NtNG7n1/Mk5ET9CIy8ZaCSbylEoWQDfAVv9Li9PSKdo+Fxnu4hDpQ== X-Received: by 2002:a05:6870:7b51:b0:1fb:75b:99bf with SMTP id ji17-20020a0568707b5100b001fb075b99bfmr2897146oab.110.1701567689416; Sat, 02 Dec 2023 17:41:29 -0800 (PST) Original-Received: from localhost.localdomain (dsl-10-141-196.b2b2c.ca. [72.10.141.196]) by smtp.gmail.com with ESMTPSA id t15-20020a05620a450f00b0077dca8ed9a4sm2869664qkp.133.2023.12.02.17.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 17:41:28 -0800 (PST) X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231203014115.26985-1-maxim.cournoyer@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=maxim.cournoyer@gmail.com; helo=mail-oi1-x232.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:22164 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