From: Thien-Thi Nguyen <ttn@glug.org>
Cc: aurelien.chanudet@gmail.com, guile-user@gnu.org
Subject: Re: setting env variable from Guile
Date: Sat, 30 Jul 2005 11:12:45 -0400 [thread overview]
Message-ID: <E1Dyt13-0006tw-Te@mail.agora-net.com> (raw)
In-Reply-To: <20050730134757.61034.qmail@web32511.mail.mud.yahoo.com> (message from Mike Gran on Sat, 30 Jul 2005 06:47:57 -0700 (PDT))
From: Mike Gran <spk121@yahoo.com>
Date: Sat, 30 Jul 2005 06:47:57 -0700 (PDT)
You could wrap the function lt_dladdsearchdir as
a Guile function and call it from your script.
fyi, this is the approach taken in Guile 1.4.x,
as implemented in libguile/lt.c, below. works fine.
thi
_____________________________________________________
/* lt.c */
/* Copyright (C) 2002 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* As a special exception, the Free Software Foundation gives permission
* for additional uses of the text contained in its release of GUILE.
*
* The exception is that, if you link the GUILE library with other files
* to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the GUILE library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the
* Free Software Foundation under the name GUILE. If you copy
* code from other Free Software Foundation releases into a copy of
* GUILE, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
/* This is wrapper code for libltdl. It should be possible to generate
it completely at some point. */
\f
#include <stdio.h>
#include "libguile/_scm.h"
#include "libguile/eq.h"
#include "libguile/list.h"
#include "libguile/validate.h"
#include "libguile/strings.h"
#include "libguile/lt.h"
#include "libltdl/ltdl.h"
static SCM
add_search_dir_x (char *dir)
{
if (0 == lt_dladdsearchdir (dir))
return SCM_UNSPECIFIED;
scm_misc_error (NULL, (char *) lt_dlerror (), SCM_EOL);
}
static SCM
set_search_path_x (char *path)
{
return ((0 == lt_dlsetsearchpath (path))
? SCM_BOOL_T
: SCM_BOOL_F);
}
static SCM
get_search_path (void)
{
return scm_makfrom0str_opt (lt_dlgetsearchpath ());
}
/* This is an experimental interface so we use a named command approach
and use a "double %" prefix. */
SCM_GLOBAL_SYMBOL (scm_sym_add_search_dir_x, "add-search-dir!");
SCM_GLOBAL_SYMBOL (scm_sym_set_search_path_x, "set-search-path!");
SCM_GLOBAL_SYMBOL (scm_sym_get_search_path, "get-search-path");
SCM_DEFINE (scm_percent_percent_ltdl, "%%ltdl", 1, 0, 1,
(SCM command, SCM args),
"Dispatch @var{command} given @var{args}, where\n"
"@var{command} is one of @code{add-search-dir!},\n"
"@code{set-search-path!}, or @code{get-search-path}\n"
"(a symbol). This interface is highly experimental.\n")
#define FUNC_NAME s_scm_percent_percent_ltdl
{
SCM_VALIDATE_SYMBOL (1, command);
/* add-search-dir! */
if (SCM_EQ_P (command, scm_sym_add_search_dir_x))
return add_search_dir_x (SCM_ROCHARS (SCM_CAR (args)));
/* set-search-path! */
if (SCM_EQ_P (command, scm_sym_set_search_path_x))
return set_search_path_x (SCM_ROCHARS (SCM_CAR (args)));
/* get-search-path */
if (SCM_EQ_P (command, scm_sym_get_search_path))
return get_search_path ();
/* badness */
scm_misc_error (NULL, "bad command", SCM_EOL);
}
#undef FUNC_NAME
\f
void
scm_init_lt ()
{
#include "libguile/lt.x"
}
/* lt.c ends here */
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2005-07-30 15:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-28 15:55 setting env variable from Guile Aurelien Chanudet
2005-07-29 14:29 ` José Roberto B. de A. Monteiro
2005-07-29 15:32 ` Aurelien Chanudet
2005-07-29 19:20 ` Christian Mauduit
2005-07-30 13:47 ` Mike Gran
2005-07-30 15:12 ` Thien-Thi Nguyen [this message]
2005-08-01 14:28 ` Jon Wilson
-- strict thread matches above, loose matches on Subject: below --
2005-07-28 14:00 Aurelien Chanudet
2005-07-29 7:28 ` David Pirotte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1Dyt13-0006tw-Te@mail.agora-net.com \
--to=ttn@glug.org \
--cc=aurelien.chanudet@gmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).