On Tuesday 29 November 2005 12:16 am, Ludovic Courtès wrote:
> Hi,
> 
> Bruce Korb <[EMAIL PROTECTED]> writes:
> 
> > Grumble, grumble.  Anyway, this belongs in your code.  We argued about this
> > before and someone said, "well, you could do it in any of several ways,
> > so we won't do it at all."  This function is entirely equivalent to
> > "scm_c_eval_string" except that error results show file name and line 
> > number.
> 
> Sorry if I'm just re-stating what you were already answered: Can't you
> implement this as a small Scheme procedure?  Something along the lines
> of:

Hi Ludovic,

*I* certainly cannot.  And I do not understand the usage of the "file"
argument.  What I am doing is extracting Scheme code from an encompassing
template and handing it off for evaluation.  My program is reading the
file, not Guile.  When I hand off the the string for evaluation, I hand
it to that ugly thing that I do not want to maintain.  I do this in
exactly the same way as one would with scm_c_eval_string, except I have
the additional parameters file name and line number.  Perhaps I could
wrap my strings in something like this:

char* fmt =
"(read-enable 'positions)
(format #t \"evaluating `~a' from ~a:~a:~a~%%\"
            sexp (port-filename (current-input-port))
           (source-property sexp \"%s\")
           (source-property sexp %d))
(begin
   %s
)";

and use it thus:

   sprintf( buf, fmt, filename, linenum, script );
   result = scm_c_eval_string( buf );

Would that work?

Your help is _surely_  appreciated!!  Thank you.

Kind regards, Bruce


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

Reply via email to