guile-devel
[Top][All Lists]
Advanced

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

Re: SCM_BOOL_T became #nil ?


From: Mark H Weaver
Subject: Re: SCM_BOOL_T became #nil ?
Date: Tue, 22 Feb 2011 03:33:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

nalaginrut <address@hidden> writes:
> I found SCM_BOOL_T will convert to #nil in the Guile.

You must be including the C headers from Guile 1.8, but linking to
libguile from Guile 2.0.

     Mark


> If we write c-function like this:
> ============================
> SCM_DEFINE(scm_my_init, "my-init", 1, 0, 0,
>             (SCM flags),
>             "Initializes my env.")
> #define FUNC_NAME s_scm_my_init
> {
>     SCM_ASSERT(scm_is_integer(flags), flags, SCM_ARG1, FUNC_NAME);
>
>     if( init_somthing(scm_to_ulong(flags)) == -1 )
>         return SCM_BOOL_F;
>     else      
>         return SCM_BOOL_T;
>
> }
> #undef FUNC_NAME
>
> =============================
> If init_something success, return true, else false.
>
> And I call this "my-init" function in the Guile:
> ---------------------------
> (if (not (my-init flags))
>   (error "init failed!")
>   (format #f "init ok!~%")
> )
> ---------------------------
>
> The problem is SCM_BOOL_T convert to #nil, and (not #nil)==>#t ! So I
> can't get a logical result.
>
> Is this conversion accepted? Or I made some mistakes?
> Any help would be appreciated! Thanks!



reply via email to

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