From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.devel Subject: Re: Adding to the end of the load path Date: Thu, 08 Nov 2012 02:03:12 +0100 Message-ID: <87liecucrz.fsf@delenn.home.rotty.xx.vu> References: <87sj8o20v0.fsf@googlemail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1352336605 8572 80.91.229.3 (8 Nov 2012 01:03:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Nov 2012 01:03:25 +0000 (UTC) Cc: guile-devel@gnu.org To: Ian Price Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Nov 08 02:03:33 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TWGWq-00084r-SG for guile-devel@m.gmane.org; Thu, 08 Nov 2012 02:03:33 +0100 Original-Received: from localhost ([::1]:46856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWGWh-0001jV-Rr for guile-devel@m.gmane.org; Wed, 07 Nov 2012 20:03:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWGWe-0001jP-R9 for guile-devel@gnu.org; Wed, 07 Nov 2012 20:03:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWGWd-0008Ip-DY for guile-devel@gnu.org; Wed, 07 Nov 2012 20:03:20 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:41991) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TWGWd-0008IV-3v for guile-devel@gnu.org; Wed, 07 Nov 2012 20:03:19 -0500 Original-Received: (qmail invoked by alias); 08 Nov 2012 01:03:17 -0000 Original-Received: from 85-127-112-13.dynamic.xdsl-line.inode.at (EHLO cubox.home.rotty.xx.vu) [85.127.112.13] by mail.gmx.net (mp033) with SMTP; 08 Nov 2012 02:03:17 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX18rjIRzeP4rWL7rGa6lVx7Jjcm8V1V2CjkvXkoYpl 9UQV7eY0WUS5ik Original-Received: from delenn.lan (delenn.home.rotty.xx.vu [IPv6:fdfb:599d:f328:2::6e]) by cubox.home.rotty.xx.vu (Postfix) with ESMTP id D9DF7160087; Thu, 8 Nov 2012 02:03:12 +0100 (CET) Original-Received: by delenn.lan (Postfix, from userid 1000) id 94495320140; Thu, 8 Nov 2012 02:03:12 +0100 (CET) In-Reply-To: <87sj8o20v0.fsf@googlemail.com> (Ian Price's message of "Mon, 05 Nov 2012 03:18:59 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.165.64.23 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15125 Archived-At: --=-=-= Content-Type: text/plain Ian Price writes: > Hi guilers, > > On the #guile IRC channel, Mark Weaver has stressed to me that he thinks > it would be a good idea for us to be able to add paths to the end of the > load path, since it would allow us to, for example, prefer a built-in guile > implementation over a guildhall provided one, when this exists. Right > now, for the srfi[0] and guile-lib, I have handled this by not adding > files to the package where they have been adopted by guile (e.g. statprof). > > Andreas Rottmann suggested something similar in February[1]. > I've attached a patch implementing that suggestion, FWIW. > I don't have any concrete proposals better than what Andreas has > suggested, but I felt I should make this post to the list, lest Mark and > I forget. > [...] > 1. http://lists.gnu.org/archive/html/guile-devel/2012-02/msg00038.html --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-More-flexible-load-path-and-load-compiled-path-handl.patch >From 1f72ddd3971a796a6f83a68ebedde7d7324c50b5 Mon Sep 17 00:00:00 2001 From: Andreas Rottmann Date: Thu, 8 Nov 2012 01:59:56 +0100 Subject: [PATCH] More flexible %load-path and %load-compiled-path handling --- libguile/load.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/libguile/load.c b/libguile/load.c index af2ca45..a05cf76 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -226,7 +226,9 @@ SCM_DEFINE (scm_parse_path, "parse-path", 1, 1, 0, "Parse @var{path}, which is expected to be a colon-separated\n" "string, into a list and return the resulting list with\n" "@var{tail} appended. If @var{path} is @code{#f}, @var{tail}\n" - "is returned.") + "is returned. In case an empty string occurs as an element\n" + "of @var{path}, @var{tail} is inserted at that point instead of\n" + "being append at the end of the list.") #define FUNC_NAME s_scm_parse_path { #ifdef __MINGW32__ @@ -237,9 +239,24 @@ SCM_DEFINE (scm_parse_path, "parse-path", 1, 1, 0, if (SCM_UNBNDP (tail)) tail = SCM_EOL; - return (scm_is_false (path) - ? tail - : scm_append_x (scm_list_2 (scm_string_split (path, sep), tail))); + if (scm_is_false (path)) + return tail; + else + { + SCM elements = scm_string_split (path, sep); + SCM seen = SCM_EOL; + SCM rest = elements; + + for (; scm_is_pair (rest); rest = SCM_CDR (rest)) + { + if (scm_is_true (scm_string_null_p (SCM_CAR (rest)))) + return scm_append_x (scm_list_2 (scm_reverse_x (seen, tail), + SCM_CDR (rest))); + seen = scm_cons (SCM_CAR (rest), seen); + } + + return scm_append_x (scm_list_2 (elements, tail)); + } } #undef FUNC_NAME -- 1.7.10.4 --=-=-= Content-Type: text/plain Regards, Rotty -- Andreas Rottmann -- --=-=-=--