This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: gh_lookup no longer works??
- To: guile@sourceware.cygnus.com
- Subject: Re: gh_lookup no longer works??
- From: stevenj@hunsmac.mit.edu (Steven G. Johnson)
- Date: Thu, 26 Aug 1999 20:29:04 -0400
- Cc: russe@ms.com
Russell McManus <russe@ms.com> wrote:
>Take a look at the guile FAQ, and read the
>http://www.gnu.org/software/guile/docs/faq/guile-faq.html#TOC_14
>entry.
I don't think the module system (which this FAQ entry describes) is
the problem, since I'm not using modules.
Actually, gh_eval_str works, but gh_lookup doesn't! (I would prefer
to use gh_lookup, which **worked in previous guile versions,** since
unlike gh_eval_str it doesn't abort with an error if the symbol isn't
defined.)
Here is the output of a version of my test program that tried
gh_lookup("foo") and gh_eval_str("foo"):
guile> (define foo 'bar)
guile> (tst)
Looking up the symbol 'foo with gh_lookup...
...it was undefined!
Evaluating the symbol 'foo with gh_eval_str...
...it was defined
Can anyone confirm this behavior, e.g. with guile 1.3.2? Here is the
test program, compiled with gcc gbug.c `guile-config link` -o gbug
(guile 1.3, Redhat 5.2 on a P-II):
#include <stdio.h>
#include <stdlib.h>
#include <guile/gh.h>
SCM tst(void)
{
SCM foo;
printf("Looking up the symbol 'foo with gh_lookup...\n");
foo = gh_lookup("foo");
printf("...it was %s\n", foo == SCM_UNDEFINED ? "undefined!" : "defined");
printf("Evaluating the symbol 'foo with gh_eval_str...\n");
foo = gh_eval_str("foo");
printf("...it was %s\n", foo == SCM_UNDEFINED ? "undefined!" :
(foo == SCM_UNSPECIFIED ? "unspecified!" : "defined"));
return SCM_UNSPECIFIED;
}
void main_entry(int argc, char *argv[])
{
gh_new_procedure("tst", tst, 0, 0, 0);
gh_repl(argc, argv);
}
int main(int argc, char *argv[])
{
gh_enter (argc, argv, main_entry);
return EXIT_SUCCESS;
}