guile-devel
[Top][All Lists]
Advanced

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

Re: How do I determine the argument type...


From: Bruce Korb
Subject: Re: How do I determine the argument type...
Date: Sun, 18 May 2003 18:44:35 -0700

Kevin Ryde wrote:
> 
> Bruce Korb <address@hidden> writes:
> >
> > A macro cannot hide the problem.  You cannot set it back to int without
> > breaking everyone who adapted to size_t.
> 
> I was thinking of something like,
> 
> #define gh_scm2newstr(str,lenp) \
>   gh_scm2newstr_helper (str, lenp, sizeof (*lenp))
> 
> Not sure if all compilers will enjoy "sizeof(*NULL)" though.

Certainly not.  Even if it did, what would the chances of ``-Wall -Werror'' be?

Nobody is responding to my real problem though, so I read some code
and pieced this together as an addition for strports.c.  The problem with
it is that it looks very version specific (viz., wouldn't work with any
version but 1.6):


EXPORT SCM
scm_c_eval_string_with_file_line( tCC* pzExpr, tCC* pzFile, int line )
{
    static const char zEx[] = "eval-string-with-file-line";
    static SCM file = SCM_UNDEFINED;
    SCM expr   = scm_makfrom0str (pzExpr);
    SCM port   = scm_mkstrport (SCM_INUM0, expr, SCM_OPN | SCM_RDNG, zEx);
    SCM res;

    SCM_PTAB_ENTRY (port)->line_number = line - 1;

    if (  (file == SCM_UNDEFINED)
       || (strcmp(SCM_CHARS (file), pzFile) != 0) )  {
        file = scm_makfrom0str (pzFile);
        SCM_PTAB_ENTRY (port)->file_name = file;
    }

    res = scm_c_call_with_current_module(
        scm_interaction_environment(), inner_eval_string, (void*)port );
    return res;
}

It seems to do what I want.




reply via email to

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