guile-devel
[Top][All Lists]
Advanced

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

Re: reprise: scm_c_eval_string_from_file_line


From: Bruce Korb
Subject: Re: reprise: scm_c_eval_string_from_file_line
Date: Tue, 08 Mar 2011 14:45:53 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11

Hi Andy!

On 03/08/11 14:28, Andy Wingo wrote:
>> SCM
>> ag_scm_c_eval_string_from_file_line(
>>     char const * pzExpr, char const * pzFile, int line)
> 
> So!  I implemented something, but it's not quite what you asked for.

Sufficiently close that the resulting code isn't "icky". :)
It no longer has the feel of tendrils stuck into the
workings of Guile code.  It isn't as trivial to me, but then
maybe there aren't a lot of folks pulling text from various
files and feeding it to "eval-string".

So, this should go under:
#if GUILE_VERSION > 200000 // anything after 2.0, e.g. 2.0.1 ??

> You can change your implementation to this:
> 
>   {
>     static SCM eval_string_var = SCM_BOOL_F;
> 
>     if (scm_is_false (eval_string_var))
>       eval_string_var = scm_c_public_lookup ("ice-9 eval-string",
>                                              "eval-string");
> 
>     return scm_call_5 (scm_variable_ref (eval_string_var),
>                        string,

Wouldn't this arg need to be SCM-ized?  viz. scm_from_locale_string (string)

>                        scm_from_locale_keyword ("file"),
>                        pzFile ? scm_from_locale_string (pzFile) : SCM_BOOL_F,
>                        scm_from_locale_keyword ("line"),
>                        scm_from_int (line));
>   }
> 
> If you want to compile the expression, add #:compile? #t to the keyword
> arguments.

I guess I'll need to read docs.  From this sentence, I'd be guessing
that I'd need to use "scm_call_7" and add:
   scm_from_locale_keyword("#:compile?"), scm_from_locale_keyword("#t"),
to the arg list.  I think you just added scm_call_5 for this purpose.

Anyway, thank you !  I do appreciate.  Regards, Bruce



reply via email to

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