guile-user
[Top][All Lists]
Advanced

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

Re: scm_defined_p(sym, env)


From: Richard Shann
Subject: Re: scm_defined_p(sym, env)
Date: Tue, 23 Aug 2011 14:26:31 +0100

I didn't find the SCM_UNBNDP() that you mention but since mailing the
list I stumbled on SCM_UNDEFINED and tried 
if(opt==SCM_UNDEFINED) ...
and that seems to work. 
So (unless I am doing something bad) I think I am back on course -
thanks!

Richard


On Tue, 2011-08-23 at 13:54 +0200, address@hidden wrote:
> On Tue, Aug 23, 2011 at 12:36:44PM +0100, Richard Shann wrote:
> > I have defined a function with one needed and one optional arg, using
> > 
> > scm_c_define_gsubr (name, 2, 0, 0, callback);
> > 
> > in my function I need to test if the second argument is present, it
> > looks like I need
> > 
> > scm_defined_p(sym, env)
> > 
> > but, if so, how do I find the value of env for the top-level
> > environment?
> 
> Not shure I understand you here, Richard. Where would sym come from?
> If  your function looks like this:
> 
>  (richards-function required-param an-optional-param)
> 
> thane your c function needs exactly two parameters:
> 
>  ricks_c_func(SCM req, SCM opt) {
>  
>  ...
> 
>   if (!SCM_UNBNDP (opt)) {
>    /* opt wasn't provided, so do something here */
>   }
> 
>   ...
> 
>  } 
> 
> 
> Does that help? 
> 
>  Cheers, Ralf Mattes
> 
> > Richard Shann
> > 
> 
> > 





reply via email to

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