guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/1] scm_set_source_properties_x: optimize if only name, line


From: Andy Wingo
Subject: Re: [PATCH 1/1] scm_set_source_properties_x: optimize if only name, line, and/or col
Date: Tue, 09 Mar 2021 21:52:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

On Sun 17 Jan 2021 23:55, Bruce Korb <bkorb@gnu.org> writes:

> [Can I] swap out this code for something better now? I've disliked
> this code for years.
>
>> static SCM
>> ag_scm_c_eval_string_from_file_line(
>>     char const * pzExpr, char const * pzFile, int line)

Since Guile 2.0.1 you can

  (use-modules (ice-9 eval-string))
  (eval-string str #:file file #:line line)

>From C:

  SCM_KEYWORD (k_file, "file");
  SCM_KEYWORD (k_line, "line");

  ...

  SCM ans =
    scm_call_5 (scm_c_public_ref ("ice-9 eval-string", "eval-string"),
                scm_from_utf8_string (str),
                k_file, scm_from utf8_string (file),
                k_line, scm_from_int (line));

Regards,

Andy



reply via email to

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