Hi Bruce, On Thu 24 Feb 2011 23:58, Bruce Korb <bk...@gnu.org> writes:
> Anyway, picking up threads from 2003 and 2008: > http://osdir.com/ml/lisp.guile.devel/2003-05/msg00202.html > http://www.mail-archive.com/guile-devel@gnu.org/msg02825.html > http://www.mail-archive.com/guile-devel@gnu.org/msg02826.html > > I would really, _really_ appreciate being able to yank it out of > my code. Below is an example of what I go through to do it. > It is simplified somewhat since I no longer support Guile 1.4. > > It simply doesn't feel like a straight forward interface. > It feels like I am starting a "process this string" function, > then inject some information, then call a function to scan > a bit then process a bit. How would it ever get compiled? > It'd be nice to be able to say, "here's some text, from this > file and this line number, give me back the compiled form" > and then call the "run it" function. But I can't. I have to > insert the file and line information. It's icky code. > 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. 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, 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. If you want to use a different language, use #:lang. See the manual in git for more. Regards, Andy -- http://wingolog.org/