guile-devel
[Top][All Lists]
Advanced

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

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


From: Bruce Korb
Subject: Re: unknown location: definition in expression context in subform optname-from of "_^"
Date: Thu, 26 Jan 2012 18:44:20 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0

On 01/26/12 18:26, Mark H Weaver wrote:
Too bad.  I do prefer clue-ful error messages and "unknown location"
just wasn't the helpful clue I needed.  Perhaps just use "improper location"?
"invalid location"?  Just not "unknown location".

That part of the error message (where "unknown location" was printed)
would normally contain the filename, line number, and column number.

Then either it ought to have printed the location, or there are new
wrinkles in the file/line number stuff that I need to know about.
That is precisely why I hate having this function in my code:

SCM
ag_scm_c_eval_string_from_file_line(
    char const * pzExpr, char const * pzFile, int line)
{
    SCM port = scm_open_input_string(AG_SCM_STR02SCM(pzExpr));

    if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
        fprintf(pfTrace, TRACE_EVAL_STRING, pzFile, line, pzExpr);

    {
        static SCM    file      = SCM_UNDEFINED;
        static char * pzOldFile = NULL;

        if ((pzOldFile == NULL) || (strcmp(pzOldFile, pzFile) != 0)) {
            if (pzOldFile != NULL)
                AGFREE(pzOldFile);
            AGDUPSTR(pzOldFile, pzFile, "scheme source");
            file = AG_SCM_STR02SCM(pzFile);
        }

        {
            SCM ln = AG_SCM_INT2SCM(line);
            scm_set_port_filename_x(port, file);
            scm_set_port_line_x(port, ln);
        }
    }

    {
        SCM ans = SCM_UNSPECIFIED;

        /* Read expressions from that port; ignore the values.  */
        for (;;) {
            SCM form = scm_read(port);
            if (SCM_EOF_OBJECT_P(form))
                break;
            ans = scm_primitive_eval_x(form);
        }

        return ans;
    }
}

Every evaluation comes from here and in this instance, "pzFile"
pointed to "/path/to/aginfo.tpl" and "line" was set to 163.
Therefore, the location should *NOT* have been unknown and
in fact, the displayed line number ought to have been 171.

Why that failed I would very much want to know so that I can
fix this ag_scm_c_eval_string_from_file_line() thingy.

The message "definition in expression context" accurately conveys the

Yes, it does.  I was thrown off by the "unknown location" stuff.

Thank you for your help!!

Regards, Bruce



reply via email to

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