[Top][All Lists]

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

Re: unknown location: definition in expression context in subform optnam

From: Mark H Weaver
Subject: Re: unknown location: definition in expression context in subform optname-from of "_^"
Date: Sat, 28 Jan 2012 14:47:17 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Andy Wingo <address@hidden> writes:

> On Sat 28 Jan 2012 17:58, Bruce Korb <address@hidden> writes:
>>> Bruce Korb <address@hidden> 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_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",
        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?


reply via email to

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