guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gh_lookup() equivalent


From: Dale P. Smith
Subject: Re: gh_lookup() equivalent
Date: Tue, 29 Jan 2002 09:28:57 -0500

On Tue, 29 Jan 2002 12:09:06 +0100 (CET)
stefan <address@hidden> wrote:

> Hello list,
> 
>   you could use `scm_c_lookup()' instead of `gh_lookup()'. 
Unfortunately> the scm equivalent throws an `unbound variable' exception
if the requested> symbol does not exist.  The former `gh_lookup()' just
returned> SCM_UNDEFINED.  Shall we provide something like
> `scm_c_lookup_no_exception()' with and additional argument passing the
> SCM location to put in the return value when successful?
> 
> SCM scm_c_lookup_no_exception (char *symbolname, SCM *value);
> 
> This could return `SCM_BOOL_T' and store in `value' when successful
and> return `SCM_BOOL_F' otherwise.

Here is one that returns SCM_UNDEFINED:

SCM
scm_c_lookup_no_exception (const char *name)
{
  SCM var = scm_sym2var (scm_str2symbol (name),
                         scm_current_module_lookup_closure (),
                         SCM_BOOL_F);
  if (SCM_FALSEP (var))
    return SCM_UNDEFINED;
  return var;
}



-- 
Dale P. Smith
Treasurer, Cleveland Linux Users Group http://cleveland.lug.net
Senior Systems Consultant, Altus Technologies Corporation
address@hidden
440-746-9000 x339



reply via email to

[Prev in Thread] Current Thread [Next in Thread]