Andy Wingo <wi...@pobox.com> writes: > On Sat 28 Jan 2012 17:58, Bruce Korb <bruce.k...@gmail.com> writes: > >>> Bruce Korb <bruce.k...@gmail.com> writes: >>> > I need to be able to locate a guile scheme expression in my ASCII >>> > text input and hand it off to Guile, telling it the file name and >>> > line number and column number of where I found the string. >>> >>> I agree that we should add a function or two to handle this more >>> conveniently. Let's talk about it after 2.0.4 has been released, and >>> hopefully we can get it into 2.0.5. >> >> Maybe less cumbersome than scm_c_eval_string_from_file_line ;) > > Didn't we settle on eval-string, with the #:file and #:line kwargs? See > eval-string in the manual.
I guess the code to use that from C would look something like this: SCM scm_c_eval_string_from_file (const char *string, const char *file_name, long line, long column) { static SCM eval_string_var, file_keyword, line_keyword, column_keyword; static int initialized = 0; SCM args[7]; if (!initialized) { eval_string_var = scm_c_public_variable ("ice-9 eval-string", "eval-string"); file_keyword = scm_from_latin1_keyword ("file"); line_keyword = scm_from_latin1_keyword ("line"); column_keyword = scm_from_latin1_keyword ("column"); initialized = 1; } args[0] = scm_from_locale_string (string); args[1] = file_keyword; args[2] = scm_from_locale_string (file_name); args[3] = line_keyword; args[4] = scm_from_long (line); args[5] = column_keyword; args[6] = scm_from_long (column); return scm_call_n (SCM_VARIABLE_REF (eval_string_var), args, 7); } This seems very awkward. Is there an easier way? Mark